diff options
Diffstat (limited to 'OpenSim/Grid/MessagingServer.Modules')
3 files changed, 81 insertions, 78 deletions
diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs index 5651a17..dedf876 100644 --- a/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs +++ b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs | |||
@@ -39,6 +39,10 @@ using OpenSim.Data; | |||
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Grid.Framework; | 40 | using OpenSim.Grid.Framework; |
41 | using Timer = System.Timers.Timer; | 41 | using Timer = System.Timers.Timer; |
42 | using OpenSim.Services.Interfaces; | ||
43 | using OpenSim.Services.Connectors; | ||
44 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
45 | |||
42 | 46 | ||
43 | namespace OpenSim.Grid.MessagingServer.Modules | 47 | namespace OpenSim.Grid.MessagingServer.Modules |
44 | { | 48 | { |
@@ -52,6 +56,8 @@ namespace OpenSim.Grid.MessagingServer.Modules | |||
52 | 56 | ||
53 | private IGridServiceCore m_messageCore; | 57 | private IGridServiceCore m_messageCore; |
54 | 58 | ||
59 | private IGridService m_GridService; | ||
60 | |||
55 | // a dictionary of all current regions this server knows about | 61 | // a dictionary of all current regions this server knows about |
56 | private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong, RegionProfileData>(); | 62 | private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong, RegionProfileData>(); |
57 | 63 | ||
@@ -59,6 +65,8 @@ namespace OpenSim.Grid.MessagingServer.Modules | |||
59 | { | 65 | { |
60 | m_cfg = config; | 66 | m_cfg = config; |
61 | m_messageCore = messageCore; | 67 | m_messageCore = messageCore; |
68 | |||
69 | m_GridService = new GridServicesConnector(m_cfg.GridServerURL); | ||
62 | } | 70 | } |
63 | 71 | ||
64 | public void Initialise() | 72 | public void Initialise() |
@@ -134,51 +142,30 @@ namespace OpenSim.Grid.MessagingServer.Modules | |||
134 | /// <returns></returns> | 142 | /// <returns></returns> |
135 | public RegionProfileData RequestRegionInfo(ulong regionHandle) | 143 | public RegionProfileData RequestRegionInfo(ulong regionHandle) |
136 | { | 144 | { |
137 | RegionProfileData regionProfile = null; | 145 | uint x = 0, y = 0; |
138 | try | 146 | Utils.LongToUInts(regionHandle, out x, out y); |
139 | { | 147 | GridRegion region = m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); |
140 | Hashtable requestData = new Hashtable(); | ||
141 | requestData["region_handle"] = regionHandle.ToString(); | ||
142 | requestData["authkey"] = m_cfg.GridSendKey; | ||
143 | |||
144 | ArrayList SendParams = new ArrayList(); | ||
145 | SendParams.Add(requestData); | ||
146 | 148 | ||
147 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 149 | if (region != null) |
150 | return GridRegionToRegionProfile(region); | ||
148 | 151 | ||
149 | XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); | 152 | else |
150 | 153 | return null; | |
151 | Hashtable responseData = (Hashtable)GridResp.Value; | 154 | } |
152 | |||
153 | if (responseData.ContainsKey("error")) | ||
154 | { | ||
155 | m_log.Error("[GRID]: error received from grid server" + responseData["error"]); | ||
156 | return null; | ||
157 | } | ||
158 | |||
159 | uint regX = Convert.ToUInt32((string)responseData["region_locx"]); | ||
160 | uint regY = Convert.ToUInt32((string)responseData["region_locy"]); | ||
161 | string internalIpStr = (string)responseData["sim_ip"]; | ||
162 | |||
163 | regionProfile = new RegionProfileData(); | ||
164 | regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]); | ||
165 | regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; | ||
166 | regionProfile.regionHandle = Utils.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize)); | ||
167 | regionProfile.regionLocX = regX; | ||
168 | regionProfile.regionLocY = regY; | ||
169 | |||
170 | regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | ||
171 | regionProfile.UUID = new UUID((string)responseData["region_UUID"]); | ||
172 | regionProfile.regionName = (string)responseData["region_name"]; | ||
173 | } | ||
174 | catch (WebException) | ||
175 | { | ||
176 | m_log.Error("[GRID]: " + | ||
177 | "Region lookup failed for: " + regionHandle.ToString() + | ||
178 | " - Is the GridServer down?"); | ||
179 | } | ||
180 | 155 | ||
181 | return regionProfile; | 156 | private RegionProfileData GridRegionToRegionProfile(GridRegion region) |
157 | { | ||
158 | RegionProfileData rprofile = new RegionProfileData(); | ||
159 | rprofile.httpPort = region.HttpPort; | ||
160 | rprofile.httpServerURI = region.ServerURI; | ||
161 | rprofile.regionLocX = (uint)(region.RegionLocX / Constants.RegionSize); | ||
162 | rprofile.regionLocY = (uint)(region.RegionLocY / Constants.RegionSize); | ||
163 | rprofile.RegionName = region.RegionName; | ||
164 | rprofile.ServerHttpPort = region.HttpPort; | ||
165 | rprofile.ServerIP = region.ExternalHostName; | ||
166 | rprofile.ServerPort = (uint)region.ExternalEndPoint.Port; | ||
167 | rprofile.Uuid = region.RegionID; | ||
168 | return rprofile; | ||
182 | } | 169 | } |
183 | 170 | ||
184 | public XmlRpcResponse RegionStartup(XmlRpcRequest request, IPEndPoint remoteClient) | 171 | public XmlRpcResponse RegionStartup(XmlRpcRequest request, IPEndPoint remoteClient) |
diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageService.cs b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs index 6f2c1ba..df5eaab 100644 --- a/OpenSim/Grid/MessagingServer.Modules/MessageService.cs +++ b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs | |||
@@ -324,44 +324,53 @@ namespace OpenSim.Grid.MessagingServer.Modules | |||
324 | /// <returns></returns> | 324 | /// <returns></returns> |
325 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request, IPEndPoint remoteClient) | 325 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request, IPEndPoint remoteClient) |
326 | { | 326 | { |
327 | Hashtable requestData = (Hashtable)request.Params[0]; | 327 | try |
328 | { | ||
329 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
330 | |||
331 | AgentCircuitData agentData = new AgentCircuitData(); | ||
332 | agentData.SessionID = new UUID((string)requestData["sessionid"]); | ||
333 | agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); | ||
334 | agentData.firstname = (string)requestData["firstname"]; | ||
335 | agentData.lastname = (string)requestData["lastname"]; | ||
336 | agentData.AgentID = new UUID((string)requestData["agentid"]); | ||
337 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | ||
338 | agentData.CapsPath = (string)requestData["caps_path"]; | ||
339 | |||
340 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | ||
341 | { | ||
342 | agentData.child = true; | ||
343 | } | ||
344 | else | ||
345 | { | ||
346 | agentData.startpos = | ||
347 | new Vector3(Convert.ToSingle(requestData["positionx"]), | ||
348 | Convert.ToSingle(requestData["positiony"]), | ||
349 | Convert.ToSingle(requestData["positionz"])); | ||
350 | agentData.child = false; | ||
351 | } | ||
328 | 352 | ||
329 | AgentCircuitData agentData = new AgentCircuitData(); | 353 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); |
330 | agentData.SessionID = new UUID((string)requestData["sessionid"]); | 354 | |
331 | agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); | 355 | m_log.InfoFormat("[LOGON]: User {0} {1} logged into region {2} as {3} agent, building indexes for user", |
332 | agentData.firstname = (string)requestData["firstname"]; | 356 | agentData.firstname, agentData.lastname, regionHandle, agentData.child ? "child" : "root"); |
333 | agentData.lastname = (string)requestData["lastname"]; | 357 | |
334 | agentData.AgentID = new UUID((string)requestData["agentid"]); | 358 | UserPresenceData up = new UserPresenceData(); |
335 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | 359 | up.agentData = agentData; |
336 | agentData.CapsPath = (string)requestData["caps_path"]; | 360 | up.friendData = GetUserFriendList(agentData.AgentID); |
361 | up.regionData = m_regionModule.GetRegionInfo(regionHandle); | ||
362 | up.OnlineYN = true; | ||
363 | up.lookupUserRegionYN = false; | ||
364 | ProcessFriendListSubscriptions(up); | ||
337 | 365 | ||
338 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | ||
339 | { | ||
340 | agentData.child = true; | ||
341 | } | 366 | } |
342 | else | 367 | catch (Exception e) |
343 | { | 368 | { |
344 | agentData.startpos = | 369 | m_log.WarnFormat("[LOGIN]: Exception on UserLoggedOn: {0}", e); |
345 | new Vector3(Convert.ToSingle(requestData["positionx"]), | ||
346 | Convert.ToSingle(requestData["positiony"]), | ||
347 | Convert.ToSingle(requestData["positionz"])); | ||
348 | agentData.child = false; | ||
349 | } | 370 | } |
350 | 371 | ||
351 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | ||
352 | |||
353 | m_log.InfoFormat("[LOGON]: User {0} {1} logged into region {2} as {3} agent, building indexes for user", | ||
354 | agentData.firstname, agentData.lastname, regionHandle, agentData.child ? "child" : "root"); | ||
355 | |||
356 | UserPresenceData up = new UserPresenceData(); | ||
357 | up.agentData = agentData; | ||
358 | up.friendData = GetUserFriendList(agentData.AgentID); | ||
359 | up.regionData = m_regionModule.GetRegionInfo(regionHandle); | ||
360 | up.OnlineYN = true; | ||
361 | up.lookupUserRegionYN = false; | ||
362 | ProcessFriendListSubscriptions(up); | ||
363 | |||
364 | return new XmlRpcResponse(); | 372 | return new XmlRpcResponse(); |
373 | |||
365 | } | 374 | } |
366 | 375 | ||
367 | /// <summary> | 376 | /// <summary> |
@@ -372,11 +381,18 @@ namespace OpenSim.Grid.MessagingServer.Modules | |||
372 | /// <returns></returns> | 381 | /// <returns></returns> |
373 | public XmlRpcResponse UserLoggedOff(XmlRpcRequest request, IPEndPoint remoteClient) | 382 | public XmlRpcResponse UserLoggedOff(XmlRpcRequest request, IPEndPoint remoteClient) |
374 | { | 383 | { |
375 | m_log.Info("[USERLOGOFF]: User logged off called"); | 384 | try |
376 | Hashtable requestData = (Hashtable)request.Params[0]; | 385 | { |
386 | m_log.Info("[USERLOGOFF]: User logged off called"); | ||
387 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
377 | 388 | ||
378 | UUID AgentID = new UUID((string)requestData["agentid"]); | 389 | UUID AgentID = new UUID((string)requestData["agentid"]); |
379 | ProcessLogOff(AgentID); | 390 | ProcessLogOff(AgentID); |
391 | } | ||
392 | catch (Exception e) | ||
393 | { | ||
394 | m_log.WarnFormat("[USERLOGOFF]: Exception on UserLoggedOff: {0}", e); | ||
395 | } | ||
380 | 396 | ||
381 | return new XmlRpcResponse(); | 397 | return new XmlRpcResponse(); |
382 | } | 398 | } |
diff --git a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs index 8006119..76c4899 100644 --- a/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs +++ b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs | |||
@@ -70,6 +70,6 @@ namespace OpenSim.Grid.MessagingServer.Modules | |||
70 | { | 70 | { |
71 | //throw new Exception("The method or operation is not implemented."); | 71 | //throw new Exception("The method or operation is not implemented."); |
72 | return null; | 72 | return null; |
73 | } | 73 | } |
74 | } | 74 | } |
75 | } | 75 | } |