diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Server/Handlers/Login/LLLoginHandlers.cs')
-rw-r--r-- | OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index f83a239..f2a5678 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | |||
@@ -53,6 +53,7 @@ namespace OpenSim.Server.Handlers.Login | |||
53 | 53 | ||
54 | private ILoginService m_LocalService; | 54 | private ILoginService m_LocalService; |
55 | private bool m_Proxy; | 55 | private bool m_Proxy; |
56 | |||
56 | 57 | ||
57 | public LLLoginHandlers(ILoginService service, bool hasProxy) | 58 | public LLLoginHandlers(ILoginService service, bool hasProxy) |
58 | { | 59 | { |
@@ -144,6 +145,17 @@ namespace OpenSim.Server.Handlers.Login | |||
144 | return FailedXMLRPCResponse(); | 145 | return FailedXMLRPCResponse(); |
145 | 146 | ||
146 | } | 147 | } |
148 | public XmlRpcResponse HandleXMLRPCLoginBlocked(XmlRpcRequest request, IPEndPoint client) | ||
149 | { | ||
150 | XmlRpcResponse response = new XmlRpcResponse(); | ||
151 | Hashtable resp = new Hashtable(); | ||
152 | |||
153 | resp["reason"] = "presence"; | ||
154 | resp["message"] = "Logins are currently restricted. Please try again later."; | ||
155 | resp["login"] = "false"; | ||
156 | response.Value = resp; | ||
157 | return response; | ||
158 | } | ||
147 | 159 | ||
148 | public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient) | 160 | public XmlRpcResponse HandleXMLRPCSetLoginLevel(XmlRpcRequest request, IPEndPoint remoteClient) |
149 | { | 161 | { |
@@ -213,6 +225,61 @@ namespace OpenSim.Server.Handlers.Login | |||
213 | return FailedOSDResponse(); | 225 | return FailedOSDResponse(); |
214 | } | 226 | } |
215 | 227 | ||
228 | public void HandleWebSocketLoginEvents(string path, WebSocketHttpServerHandler sock) | ||
229 | { | ||
230 | sock.MaxPayloadSize = 16384; //16 kb payload | ||
231 | sock.InitialMsgTimeout = 5000; //5 second first message to trigger at least one of these events | ||
232 | sock.NoDelay_TCP_Nagle = true; | ||
233 | sock.OnData += delegate(object sender, WebsocketDataEventArgs data) { sock.Close("fail"); }; | ||
234 | sock.OnPing += delegate(object sender, PingEventArgs pingdata) { sock.Close("fail"); }; | ||
235 | sock.OnPong += delegate(object sender, PongEventArgs pongdata) { sock.Close("fail"); }; | ||
236 | sock.OnText += delegate(object sender, WebsocketTextEventArgs text) | ||
237 | { | ||
238 | OSD request = null; | ||
239 | try | ||
240 | { | ||
241 | request = OSDParser.DeserializeJson(text.Data); | ||
242 | if (!(request is OSDMap)) | ||
243 | { | ||
244 | sock.SendMessage(OSDParser.SerializeJsonString(FailedOSDResponse())); | ||
245 | } | ||
246 | else | ||
247 | { | ||
248 | OSDMap req = request as OSDMap; | ||
249 | string first = req["firstname"].AsString(); | ||
250 | string last = req["lastname"].AsString(); | ||
251 | string passwd = req["passwd"].AsString(); | ||
252 | string start = req["startlocation"].AsString(); | ||
253 | string version = req["version"].AsString(); | ||
254 | string channel = req["channel"].AsString(); | ||
255 | string mac = req["mac"].AsString(); | ||
256 | string id0 = req["id0"].AsString(); | ||
257 | UUID scope = UUID.Zero; | ||
258 | IPEndPoint endPoint = | ||
259 | (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); | ||
260 | LoginResponse reply = null; | ||
261 | reply = m_LocalService.Login(first, last, passwd, start, scope, version, | ||
262 | channel, mac, id0, endPoint); | ||
263 | sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); | ||
264 | |||
265 | } | ||
266 | |||
267 | } | ||
268 | catch (Exception) | ||
269 | { | ||
270 | sock.SendMessage(OSDParser.SerializeJsonString(FailedOSDResponse())); | ||
271 | } | ||
272 | finally | ||
273 | { | ||
274 | sock.Close("success"); | ||
275 | } | ||
276 | }; | ||
277 | |||
278 | sock.HandshakeAndUpgrade(); | ||
279 | |||
280 | } | ||
281 | |||
282 | |||
216 | private XmlRpcResponse FailedXMLRPCResponse() | 283 | private XmlRpcResponse FailedXMLRPCResponse() |
217 | { | 284 | { |
218 | Hashtable hash = new Hashtable(); | 285 | Hashtable hash = new Hashtable(); |