From 7a54467bed7e1da77f7e1a45ee01dfc709b5608d Mon Sep 17 00:00:00 2001 From: gareth Date: Wed, 14 Mar 2007 03:34:49 +0000 Subject: merged new OpenSim from branches/ogs-cs --- .../RemoteGridServers/AssemblyInfo.cs | 2 +- src/RemoteServers/RemoteGridServers/RemoteGrid.cs | 48 ++++++++++++---------- 2 files changed, 28 insertions(+), 22 deletions(-) (limited to 'src/RemoteServers/RemoteGridServers') diff --git a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs b/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs index 3978650..b6953d4 100644 --- a/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs +++ b/src/RemoteServers/RemoteGridServers/AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Runtime.InteropServices; [assembly: ComVisibleAttribute(false)] [assembly: CLSCompliantAttribute(false)] -[assembly: AssemblyVersionAttribute("0.1.*.192")] +[assembly: AssemblyVersionAttribute("0.1.*.193206")] [assembly: AssemblyTitleAttribute("opensim-remoteservers")] [assembly: AssemblyDescriptionAttribute("Connects to remote OGS installation")] [assembly: AssemblyCopyrightAttribute("Copyright © OGS development team 2007")] diff --git a/src/RemoteServers/RemoteGridServers/RemoteGrid.cs b/src/RemoteServers/RemoteGridServers/RemoteGrid.cs index 428d5f5..26cd137 100644 --- a/src/RemoteServers/RemoteGridServers/RemoteGrid.cs +++ b/src/RemoteServers/RemoteGridServers/RemoteGrid.cs @@ -69,7 +69,13 @@ namespace RemoteGridServers { private string GridServerUrl; private string GridSendKey; - + private Dictionary AgentCircuits = new Dictionary(); + + public Dictionary agentcircuits { + get {return AgentCircuits;} + set {AgentCircuits=value;} + } + public RemoteGridServer() { ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created"); @@ -79,26 +85,21 @@ namespace RemoteGridServers { return true; } - public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) + + + public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) { + agentcircuitdata validcircuit=this.AgentCircuits[circuitcode]; AuthenticateResponse user = new AuthenticateResponse(); - - WebRequest CheckSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + "/" + circuitCode.ToString() + "/exists"); - WebResponse GridResponse = CheckSession.GetResponse(); - StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); - String grTest = sr.ReadLine(); - sr.Close(); - GridResponse.Close(); - if(String.IsNullOrEmpty(grTest) || grTest.Equals("1")) + if((sessionID==validcircuit.SessionID) && (agentID==validcircuit.AgentID)) { // YAY! Valid login user.Authorised = true; user.LoginInfo = new Login(); user.LoginInfo.Agent = agentID; user.LoginInfo.Session = sessionID; - user.LoginInfo.First = ""; - user.LoginInfo.Last = ""; - + user.LoginInfo.First = validcircuit.firstname; + user.LoginInfo.Last = validcircuit.lastname; } else { @@ -111,13 +112,18 @@ namespace RemoteGridServers public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) { - WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + "/" + circuitCode.ToString() + "/delete"); - WebResponse GridResponse = DeleteSession.GetResponse(); - StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); - String grTest = sr.ReadLine(); - sr.Close(); - GridResponse.Close(); - ServerConsole.MainConsole.Instance.WriteLine("DEBUG: " + grTest); + WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + sessionID.ToString()); + DeleteSession.Method="DELETE"; + DeleteSession.ContentType="text/plaintext"; + DeleteSession.ContentLength=0; + + StreamWriter stOut = new StreamWriter (DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII); + stOut.Write(""); + stOut.Close(); + + StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream()); + string GridResponse = stIn.ReadToEnd(); + stIn.Close(); return(true); } @@ -213,7 +219,7 @@ namespace RemoteGridServers } } } - + public class BlockingQueue< T > { private Queue< T > _queue = new Queue< T >(); private object _queueSync = new object(); -- cgit v1.1