diff options
Diffstat (limited to 'src/RemoteServers/RemoteGridServers/RemoteGrid.cs')
-rw-r--r-- | src/RemoteServers/RemoteGridServers/RemoteGrid.cs | 48 |
1 files changed, 27 insertions, 21 deletions
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 | |||
69 | { | 69 | { |
70 | private string GridServerUrl; | 70 | private string GridServerUrl; |
71 | private string GridSendKey; | 71 | private string GridSendKey; |
72 | 72 | private Dictionary<uint, agentcircuitdata> AgentCircuits = new Dictionary<uint, agentcircuitdata>(); | |
73 | |||
74 | public Dictionary<uint, agentcircuitdata> agentcircuits { | ||
75 | get {return AgentCircuits;} | ||
76 | set {AgentCircuits=value;} | ||
77 | } | ||
78 | |||
73 | public RemoteGridServer() | 79 | public RemoteGridServer() |
74 | { | 80 | { |
75 | ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created"); | 81 | ServerConsole.MainConsole.Instance.WriteLine("Remote Grid Server class created"); |
@@ -79,26 +85,21 @@ namespace RemoteGridServers | |||
79 | { | 85 | { |
80 | return true; | 86 | return true; |
81 | } | 87 | } |
82 | public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | 88 | |
89 | |||
90 | public AuthenticateResponse AuthenticateSession(LLUUID sessionID, LLUUID agentID, uint circuitcode) | ||
83 | { | 91 | { |
92 | agentcircuitdata validcircuit=this.AgentCircuits[circuitcode]; | ||
84 | AuthenticateResponse user = new AuthenticateResponse(); | 93 | AuthenticateResponse user = new AuthenticateResponse(); |
85 | 94 | if((sessionID==validcircuit.SessionID) && (agentID==validcircuit.AgentID)) | |
86 | WebRequest CheckSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + "/" + circuitCode.ToString() + "/exists"); | ||
87 | WebResponse GridResponse = CheckSession.GetResponse(); | ||
88 | StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); | ||
89 | String grTest = sr.ReadLine(); | ||
90 | sr.Close(); | ||
91 | GridResponse.Close(); | ||
92 | if(String.IsNullOrEmpty(grTest) || grTest.Equals("1")) | ||
93 | { | 95 | { |
94 | // YAY! Valid login | 96 | // YAY! Valid login |
95 | user.Authorised = true; | 97 | user.Authorised = true; |
96 | user.LoginInfo = new Login(); | 98 | user.LoginInfo = new Login(); |
97 | user.LoginInfo.Agent = agentID; | 99 | user.LoginInfo.Agent = agentID; |
98 | user.LoginInfo.Session = sessionID; | 100 | user.LoginInfo.Session = sessionID; |
99 | user.LoginInfo.First = ""; | 101 | user.LoginInfo.First = validcircuit.firstname; |
100 | user.LoginInfo.Last = ""; | 102 | user.LoginInfo.Last = validcircuit.lastname; |
101 | |||
102 | } | 103 | } |
103 | else | 104 | else |
104 | { | 105 | { |
@@ -111,13 +112,18 @@ namespace RemoteGridServers | |||
111 | 112 | ||
112 | public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) | 113 | public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode) |
113 | { | 114 | { |
114 | WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + "/" + circuitCode.ToString() + "/delete"); | 115 | WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + sessionID.ToString()); |
115 | WebResponse GridResponse = DeleteSession.GetResponse(); | 116 | DeleteSession.Method="DELETE"; |
116 | StreamReader sr = new StreamReader(GridResponse.GetResponseStream()); | 117 | DeleteSession.ContentType="text/plaintext"; |
117 | String grTest = sr.ReadLine(); | 118 | DeleteSession.ContentLength=0; |
118 | sr.Close(); | 119 | |
119 | GridResponse.Close(); | 120 | StreamWriter stOut = new StreamWriter (DeleteSession.GetRequestStream(), System.Text.Encoding.ASCII); |
120 | ServerConsole.MainConsole.Instance.WriteLine("DEBUG: " + grTest); | 121 | stOut.Write(""); |
122 | stOut.Close(); | ||
123 | |||
124 | StreamReader stIn = new StreamReader(DeleteSession.GetResponse().GetResponseStream()); | ||
125 | string GridResponse = stIn.ReadToEnd(); | ||
126 | stIn.Close(); | ||
121 | return(true); | 127 | return(true); |
122 | } | 128 | } |
123 | 129 | ||
@@ -213,7 +219,7 @@ namespace RemoteGridServers | |||
213 | } | 219 | } |
214 | } | 220 | } |
215 | } | 221 | } |
216 | 222 | ||
217 | public class BlockingQueue< T > { | 223 | public class BlockingQueue< T > { |
218 | private Queue< T > _queue = new Queue< T >(); | 224 | private Queue< T > _queue = new Queue< T >(); |
219 | private object _queueSync = new object(); | 225 | private object _queueSync = new object(); |