diff options
author | Adam Frisby | 2008-05-01 18:04:42 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-01 18:04:42 +0000 |
commit | 20a9bf08f51351e1e0a9de94f184ff56cd572665 (patch) | |
tree | 52da64dab26353b903c8e4befed0178fa72a188b /OpenSim/Grid/MessagingServer/MessageService.cs | |
parent | More config cleanup in LaunchSLClient. (diff) | |
download | opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.zip opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.gz opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.bz2 opensim-SC-20a9bf08f51351e1e0a9de94f184ff56cd572665.tar.xz |
* Rolled back a few changes.
Diffstat (limited to 'OpenSim/Grid/MessagingServer/MessageService.cs')
-rw-r--r-- | OpenSim/Grid/MessagingServer/MessageService.cs | 151 |
1 files changed, 75 insertions, 76 deletions
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs index 33c133d..50e06af 100644 --- a/OpenSim/Grid/MessagingServer/MessageService.cs +++ b/OpenSim/Grid/MessagingServer/MessageService.cs | |||
@@ -45,16 +45,16 @@ namespace OpenSim.Grid.MessagingServer | |||
45 | { | 45 | { |
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private readonly MessageServerConfig m_cfg; | 48 | private MessageServerConfig m_cfg; |
49 | private readonly Hashtable m_presence_BackReferences = new Hashtable(); | ||
50 | 49 | ||
51 | //A hashtable of all current presences this server knows about | 50 | //A hashtable of all current presences this server knows about |
52 | private readonly Hashtable m_presences = new Hashtable(); | 51 | private Hashtable m_presences = new Hashtable(); |
53 | 52 | ||
54 | //a hashtable of all current regions this server knows about | 53 | //a hashtable of all current regions this server knows about |
55 | private readonly Hashtable m_regionInfoCache = new Hashtable(); | 54 | private Hashtable m_regionInfoCache = new Hashtable(); |
56 | 55 | ||
57 | //A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing | 56 | //A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing |
57 | private Hashtable m_presence_BackReferences = new Hashtable(); | ||
58 | 58 | ||
59 | // Hashtable containing work units that need to be processed | 59 | // Hashtable containing work units that need to be processed |
60 | private Hashtable m_unProcessedWorkUnits = new Hashtable(); | 60 | private Hashtable m_unProcessedWorkUnits = new Hashtable(); |
@@ -63,13 +63,13 @@ namespace OpenSim.Grid.MessagingServer | |||
63 | { | 63 | { |
64 | m_cfg = cfg; | 64 | m_cfg = cfg; |
65 | } | 65 | } |
66 | 66 | ||
67 | #region RegionComms Methods | 67 | #region RegionComms Methods |
68 | 68 | ||
69 | #endregion | 69 | #endregion |
70 | 70 | ||
71 | #region FriendList Methods | 71 | #region FriendList Methods |
72 | 72 | ||
73 | /// <summary> | 73 | /// <summary> |
74 | /// Process Friendlist subscriptions for a user | 74 | /// Process Friendlist subscriptions for a user |
75 | /// The login method calls this for a User | 75 | /// The login method calls this for a User |
@@ -87,14 +87,14 @@ namespace OpenSim.Grid.MessagingServer | |||
87 | for (int i = 0; i < uFriendList.Count; i++) | 87 | for (int i = 0; i < uFriendList.Count; i++) |
88 | { | 88 | { |
89 | //m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend); | 89 | //m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend); |
90 | // m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID); | 90 | // m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID); |
91 | 91 | ||
92 | if (m_presences.Contains(uFriendList[i].Friend)) | 92 | if (m_presences.Contains(uFriendList[i].Friend)) |
93 | { | 93 | { |
94 | UserPresenceData friendup = (UserPresenceData) m_presences[uFriendList[i].Friend]; | 94 | UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i].Friend]; |
95 | // Add backreference | 95 | // Add backreference |
96 | 96 | ||
97 | SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i], i); | 97 | SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | } | 100 | } |
@@ -108,10 +108,10 @@ namespace OpenSim.Grid.MessagingServer | |||
108 | /// <param name="friendpresence">P2</param> | 108 | /// <param name="friendpresence">P2</param> |
109 | /// <param name="uFriendListItem"></param> | 109 | /// <param name="uFriendListItem"></param> |
110 | /// <param name="uFriendListIndex"></param> | 110 | /// <param name="uFriendListIndex"></param> |
111 | public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence, | 111 | public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence, |
112 | FriendListItem uFriendListItem, int uFriendListIndex) | 112 | FriendListItem uFriendListItem, int uFriendListIndex) |
113 | { | 113 | { |
114 | if ((uFriendListItem.FriendListOwnerPerms & (uint) FriendRights.CanSeeOnline) != 0) | 114 | if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) |
115 | { | 115 | { |
116 | // Subscribe and Send Out updates | 116 | // Subscribe and Send Out updates |
117 | if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID)) | 117 | if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID)) |
@@ -126,13 +126,13 @@ namespace OpenSim.Grid.MessagingServer | |||
126 | PresenceInformer friendlistupdater = new PresenceInformer(); | 126 | PresenceInformer friendlistupdater = new PresenceInformer(); |
127 | friendlistupdater.presence1 = friendpresence; | 127 | friendlistupdater.presence1 = friendpresence; |
128 | friendlistupdater.presence2 = userpresence; | 128 | friendlistupdater.presence2 = userpresence; |
129 | WaitCallback cb = friendlistupdater.go; | 129 | WaitCallback cb = new WaitCallback(friendlistupdater.go); |
130 | ThreadPool.QueueUserWorkItem(cb); | 130 | ThreadPool.QueueUserWorkItem(cb); |
131 | 131 | ||
132 | //SendRegionPresenceUpdate(friendpresence, userpresence); | 132 | //SendRegionPresenceUpdate(friendpresence, userpresence); |
133 | } | 133 | } |
134 | 134 | ||
135 | if ((uFriendListItem.FriendPerms & (uint) FriendRights.CanSeeOnline) != 0) | 135 | if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) |
136 | { | 136 | { |
137 | if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) | 137 | if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) |
138 | { | 138 | { |
@@ -147,9 +147,9 @@ namespace OpenSim.Grid.MessagingServer | |||
147 | friendlistupdater.presence1 = userpresence; | 147 | friendlistupdater.presence1 = userpresence; |
148 | friendlistupdater.presence2 = friendpresence; | 148 | friendlistupdater.presence2 = friendpresence; |
149 | 149 | ||
150 | WaitCallback cb2 = friendlistupdater.go; | 150 | WaitCallback cb2 = new WaitCallback(friendlistupdater.go); |
151 | ThreadPool.QueueUserWorkItem(cb2); | 151 | ThreadPool.QueueUserWorkItem(cb2); |
152 | 152 | ||
153 | //SendRegionPresenceUpdate(userpresence, friendpresence); | 153 | //SendRegionPresenceUpdate(userpresence, friendpresence); |
154 | } | 154 | } |
155 | } | 155 | } |
@@ -164,7 +164,7 @@ namespace OpenSim.Grid.MessagingServer | |||
164 | { | 164 | { |
165 | if (m_presence_BackReferences.Contains(friendID)) | 165 | if (m_presence_BackReferences.Contains(friendID)) |
166 | { | 166 | { |
167 | List<LLUUID> presenseBackReferences = (List<LLUUID>) m_presence_BackReferences[friendID]; | 167 | List<LLUUID> presenseBackReferences = (List<LLUUID>)m_presence_BackReferences[friendID]; |
168 | if (!presenseBackReferences.Contains(agentID)) | 168 | if (!presenseBackReferences.Contains(agentID)) |
169 | { | 169 | { |
170 | presenseBackReferences.Add(agentID); | 170 | presenseBackReferences.Add(agentID); |
@@ -188,7 +188,7 @@ namespace OpenSim.Grid.MessagingServer | |||
188 | { | 188 | { |
189 | if (m_presence_BackReferences.Contains(friendID)) | 189 | if (m_presence_BackReferences.Contains(friendID)) |
190 | { | 190 | { |
191 | List<LLUUID> presenseBackReferences = (List<LLUUID>) m_presence_BackReferences[friendID]; | 191 | List<LLUUID> presenseBackReferences = (List<LLUUID>)m_presence_BackReferences[friendID]; |
192 | if (presenseBackReferences.Contains(agentID)) | 192 | if (presenseBackReferences.Contains(agentID)) |
193 | { | 193 | { |
194 | presenseBackReferences.Remove(agentID); | 194 | presenseBackReferences.Remove(agentID); |
@@ -216,29 +216,29 @@ namespace OpenSim.Grid.MessagingServer | |||
216 | { | 216 | { |
217 | if (m_presences.Contains(AgentID)) | 217 | if (m_presences.Contains(AgentID)) |
218 | { | 218 | { |
219 | AgentData = (UserPresenceData) m_presences[AgentID]; | 219 | AgentData = (UserPresenceData)m_presences[AgentID]; |
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | if (AgentData != null) | 223 | if (AgentData != null) |
224 | { | 224 | { |
225 | AgentsNeedingNotification = AgentData.subscriptionData; | 225 | AgentsNeedingNotification = AgentData.subscriptionData; |
226 | //lock (m_presence_BackReferences) | 226 | //lock (m_presence_BackReferences) |
227 | //{ | 227 | //{ |
228 | //if (m_presence_BackReferences.Contains(AgentID)) | 228 | //if (m_presence_BackReferences.Contains(AgentID)) |
229 | //{ | 229 | //{ |
230 | //AgentsNeedingNotification = (List<LLUUID>)m_presence_BackReferences[AgentID]; | 230 | //AgentsNeedingNotification = (List<LLUUID>)m_presence_BackReferences[AgentID]; |
231 | //} | 231 | //} |
232 | //} | 232 | //} |
233 | 233 | ||
234 | for (int i = 0; i < AgentsNeedingNotification.Count; i++) | 234 | for (int i = 0; i < AgentsNeedingNotification.Count; i++) |
235 | { | 235 | { |
236 | // TODO: Do Region Notifications | 236 | // TODO: Do Region Notifications |
237 | lock (m_presences) | 237 | lock(m_presences) |
238 | { | 238 | { |
239 | if (m_presences.Contains(AgentsNeedingNotification[i])) | 239 | if (m_presences.Contains(AgentsNeedingNotification[i])) |
240 | { | 240 | { |
241 | friendd = (UserPresenceData) m_presences[AgentsNeedingNotification[i]]; | 241 | friendd = (UserPresenceData)m_presences[AgentsNeedingNotification[i]]; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
@@ -266,7 +266,7 @@ namespace OpenSim.Grid.MessagingServer | |||
266 | friendlistupdater.presence1 = AgentData; | 266 | friendlistupdater.presence1 = AgentData; |
267 | friendlistupdater.presence2 = friendd; | 267 | friendlistupdater.presence2 = friendd; |
268 | 268 | ||
269 | WaitCallback cb3 = friendlistupdater.go; | 269 | WaitCallback cb3 = new WaitCallback(friendlistupdater.go); |
270 | ThreadPool.QueueUserWorkItem(cb3); | 270 | ThreadPool.QueueUserWorkItem(cb3); |
271 | 271 | ||
272 | //SendRegionPresenceUpdate(AgentData, friendd); | 272 | //SendRegionPresenceUpdate(AgentData, friendd); |
@@ -276,7 +276,7 @@ namespace OpenSim.Grid.MessagingServer | |||
276 | } | 276 | } |
277 | } | 277 | } |
278 | } | 278 | } |
279 | 279 | ||
280 | #endregion | 280 | #endregion |
281 | 281 | ||
282 | #region UserServer Comms | 282 | #region UserServer Comms |
@@ -298,17 +298,18 @@ namespace OpenSim.Grid.MessagingServer | |||
298 | parameters.Add(param); | 298 | parameters.Add(param); |
299 | XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); | 299 | XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); |
300 | XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000); | 300 | XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000); |
301 | Hashtable respData = (Hashtable) resp.Value; | 301 | Hashtable respData = (Hashtable)resp.Value; |
302 | 302 | ||
303 | if (respData.Contains("avcount")) | 303 | if (respData.Contains("avcount")) |
304 | { | 304 | { |
305 | buddylist = ConvertXMLRPCDataToFriendListItemList(respData); | 305 | buddylist = ConvertXMLRPCDataToFriendListItemList(respData); |
306 | } | 306 | } |
307 | |||
307 | } | 308 | } |
308 | catch (WebException e) | 309 | catch (WebException e) |
309 | { | 310 | { |
310 | m_log.Warn("Error when trying to fetch Avatar's friends list: " + | 311 | m_log.Warn("Error when trying to fetch Avatar's friends list: " + |
311 | e.Message); | 312 | e.Message); |
312 | // Return Empty list (no friends) | 313 | // Return Empty list (no friends) |
313 | } | 314 | } |
314 | return buddylist; | 315 | return buddylist; |
@@ -322,16 +323,16 @@ namespace OpenSim.Grid.MessagingServer | |||
322 | public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) | 323 | public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) |
323 | { | 324 | { |
324 | List<FriendListItem> buddylist = new List<FriendListItem>(); | 325 | List<FriendListItem> buddylist = new List<FriendListItem>(); |
325 | int buddycount = Convert.ToInt32((string) data["avcount"]); | 326 | int buddycount = Convert.ToInt32((string)data["avcount"]); |
326 | 327 | ||
327 | for (int i = 0; i < buddycount; i++) | 328 | for (int i = 0; i < buddycount; i++) |
328 | { | 329 | { |
329 | FriendListItem buddylistitem = new FriendListItem(); | 330 | FriendListItem buddylistitem = new FriendListItem(); |
330 | 331 | ||
331 | buddylistitem.FriendListOwner = new LLUUID((string) data["ownerID" + i]); | 332 | buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]); |
332 | buddylistitem.Friend = new LLUUID((string) data["friendID" + i]); | 333 | buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]); |
333 | buddylistitem.FriendListOwnerPerms = (uint) Convert.ToInt32((string) data["ownerPerms" + i]); | 334 | buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); |
334 | buddylistitem.FriendPerms = (uint) Convert.ToInt32((string) data["friendPerms" + i]); | 335 | buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); |
335 | 336 | ||
336 | buddylist.Add(buddylistitem); | 337 | buddylist.Add(buddylistitem); |
337 | } | 338 | } |
@@ -349,7 +350,7 @@ namespace OpenSim.Grid.MessagingServer | |||
349 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) | 350 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) |
350 | { | 351 | { |
351 | m_log.Info("[LOGON]: User logged on, building indexes for user"); | 352 | m_log.Info("[LOGON]: User logged on, building indexes for user"); |
352 | Hashtable requestData = (Hashtable) request.Params[0]; | 353 | Hashtable requestData = (Hashtable)request.Params[0]; |
353 | 354 | ||
354 | //requestData["sendkey"] = serv.sendkey; | 355 | //requestData["sendkey"] = serv.sendkey; |
355 | //requestData["agentid"] = agentID.ToString(); | 356 | //requestData["agentid"] = agentID.ToString(); |
@@ -363,13 +364,13 @@ namespace OpenSim.Grid.MessagingServer | |||
363 | //requestData["lastname"] = lastname; | 364 | //requestData["lastname"] = lastname; |
364 | 365 | ||
365 | AgentCircuitData agentData = new AgentCircuitData(); | 366 | AgentCircuitData agentData = new AgentCircuitData(); |
366 | agentData.SessionID = new LLUUID((string) requestData["sessionid"]); | 367 | agentData.SessionID = new LLUUID((string)requestData["sessionid"]); |
367 | agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]); | 368 | agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); |
368 | agentData.firstname = (string) requestData["firstname"]; | 369 | agentData.firstname = (string)requestData["firstname"]; |
369 | agentData.lastname = (string) requestData["lastname"]; | 370 | agentData.lastname = (string)requestData["lastname"]; |
370 | agentData.AgentID = new LLUUID((string) requestData["agentid"]); | 371 | agentData.AgentID = new LLUUID((string)requestData["agentid"]); |
371 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | 372 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); |
372 | agentData.CapsPath = (string) requestData["caps_path"]; | 373 | agentData.CapsPath = (string)requestData["caps_path"]; |
373 | 374 | ||
374 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | 375 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) |
375 | { | 376 | { |
@@ -378,13 +379,13 @@ namespace OpenSim.Grid.MessagingServer | |||
378 | else | 379 | else |
379 | { | 380 | { |
380 | agentData.startpos = | 381 | agentData.startpos = |
381 | new LLVector3(Convert.ToUInt32(requestData["positionx"]), | 382 | new LLVector3(Convert.ToUInt32(requestData["positionx"]), |
382 | Convert.ToUInt32(requestData["positiony"]), | 383 | Convert.ToUInt32(requestData["positiony"]), |
383 | Convert.ToUInt32(requestData["positionz"])); | 384 | Convert.ToUInt32(requestData["positionz"])); |
384 | agentData.child = false; | 385 | agentData.child = false; |
385 | } | 386 | } |
386 | 387 | ||
387 | ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); | 388 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); |
388 | 389 | ||
389 | UserPresenceData up = new UserPresenceData(); | 390 | UserPresenceData up = new UserPresenceData(); |
390 | up.agentData = agentData; | 391 | up.agentData = agentData; |
@@ -397,7 +398,7 @@ namespace OpenSim.Grid.MessagingServer | |||
397 | 398 | ||
398 | return new XmlRpcResponse(); | 399 | return new XmlRpcResponse(); |
399 | } | 400 | } |
400 | 401 | ||
401 | /// <summary> | 402 | /// <summary> |
402 | /// The UserServer got a Logoff message | 403 | /// The UserServer got a Logoff message |
403 | /// Cleanup time for that user. Send out presence notifications | 404 | /// Cleanup time for that user. Send out presence notifications |
@@ -406,9 +407,9 @@ namespace OpenSim.Grid.MessagingServer | |||
406 | /// <returns></returns> | 407 | /// <returns></returns> |
407 | public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) | 408 | public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) |
408 | { | 409 | { |
409 | Hashtable requestData = (Hashtable) request.Params[0]; | 410 | Hashtable requestData = (Hashtable)request.Params[0]; |
410 | 411 | ||
411 | LLUUID AgentID = new LLUUID((string) requestData["agentid"]); | 412 | LLUUID AgentID = new LLUUID((string)requestData["agentid"]); |
412 | 413 | ||
413 | ProcessLogOff(AgentID); | 414 | ProcessLogOff(AgentID); |
414 | 415 | ||
@@ -430,9 +431,9 @@ namespace OpenSim.Grid.MessagingServer | |||
430 | RegionProfileData regionInfo = null; | 431 | RegionProfileData regionInfo = null; |
431 | if (m_regionInfoCache.Contains(regionhandle)) | 432 | if (m_regionInfoCache.Contains(regionhandle)) |
432 | { | 433 | { |
433 | regionInfo = (RegionProfileData) m_regionInfoCache[regionhandle]; | 434 | regionInfo = (RegionProfileData)m_regionInfoCache[regionhandle]; |
434 | } | 435 | } |
435 | else | 436 | else |
436 | { | 437 | { |
437 | regionInfo = RequestRegionInfo(regionhandle); | 438 | regionInfo = RequestRegionInfo(regionhandle); |
438 | } | 439 | } |
@@ -446,8 +447,7 @@ namespace OpenSim.Grid.MessagingServer | |||
446 | /// <param name="regionHandle"></param> | 447 | /// <param name="regionHandle"></param> |
447 | /// <returns></returns> | 448 | /// <returns></returns> |
448 | public RegionProfileData RequestRegionInfo(ulong regionHandle) | 449 | public RegionProfileData RequestRegionInfo(ulong regionHandle) |
449 | { | 450 | { RegionProfileData regionProfile = null; |
450 | RegionProfileData regionProfile = null; | ||
451 | try | 451 | try |
452 | { | 452 | { |
453 | Hashtable requestData = new Hashtable(); | 453 | Hashtable requestData = new Hashtable(); |
@@ -457,8 +457,8 @@ namespace OpenSim.Grid.MessagingServer | |||
457 | SendParams.Add(requestData); | 457 | SendParams.Add(requestData); |
458 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 458 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
459 | XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); | 459 | XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); |
460 | 460 | ||
461 | Hashtable responseData = (Hashtable) GridResp.Value; | 461 | Hashtable responseData = (Hashtable)GridResp.Value; |
462 | 462 | ||
463 | if (responseData.ContainsKey("error")) | 463 | if (responseData.ContainsKey("error")) |
464 | { | 464 | { |
@@ -466,23 +466,23 @@ namespace OpenSim.Grid.MessagingServer | |||
466 | return null; | 466 | return null; |
467 | } | 467 | } |
468 | 468 | ||
469 | uint regX = Convert.ToUInt32((string) responseData["region_locx"]); | 469 | uint regX = Convert.ToUInt32((string)responseData["region_locx"]); |
470 | uint regY = Convert.ToUInt32((string) responseData["region_locy"]); | 470 | uint regY = Convert.ToUInt32((string)responseData["region_locy"]); |
471 | string internalIpStr = (string) responseData["sim_ip"]; | 471 | string internalIpStr = (string)responseData["sim_ip"]; |
472 | uint port = Convert.ToUInt32(responseData["sim_port"]); | 472 | uint port = Convert.ToUInt32(responseData["sim_port"]); |
473 | string externalUri = (string) responseData["sim_uri"]; | 473 | string externalUri = (string)responseData["sim_uri"]; |
474 | string neighbourExternalUri = externalUri; | 474 | string neighbourExternalUri = externalUri; |
475 | 475 | ||
476 | regionProfile = new RegionProfileData(); | 476 | regionProfile = new RegionProfileData(); |
477 | regionProfile.httpPort = (uint) Convert.ToInt32((string) responseData["http_port"]); | 477 | regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]); |
478 | regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; | 478 | regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; |
479 | regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize)); | 479 | regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize)); |
480 | regionProfile.regionLocX = regX; | 480 | regionProfile.regionLocX = regX; |
481 | regionProfile.regionLocY = regY; | 481 | regionProfile.regionLocY = regY; |
482 | 482 | ||
483 | regionProfile.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | 483 | regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); |
484 | regionProfile.UUID = new LLUUID((string) responseData["region_UUID"]); | 484 | regionProfile.UUID = new LLUUID((string)responseData["region_UUID"]); |
485 | regionProfile.regionName = (string) responseData["region_name"]; | 485 | regionProfile.regionName = (string)responseData["region_name"]; |
486 | lock (m_regionInfoCache) | 486 | lock (m_regionInfoCache) |
487 | { | 487 | { |
488 | if (!m_regionInfoCache.Contains(regionHandle)) | 488 | if (!m_regionInfoCache.Contains(regionHandle)) |
@@ -494,31 +494,31 @@ namespace OpenSim.Grid.MessagingServer | |||
494 | catch (WebException) | 494 | catch (WebException) |
495 | { | 495 | { |
496 | m_log.Error("[GRID]: " + | 496 | m_log.Error("[GRID]: " + |
497 | "Region lookup failed for: " + regionHandle + | 497 | "Region lookup failed for: " + regionHandle.ToString() + |
498 | " - Is the GridServer down?"); | 498 | " - Is the GridServer down?"); |
499 | return null; | 499 | return null; |
500 | } | 500 | } |
501 | 501 | ||
502 | return regionProfile; | 502 | return regionProfile; |
503 | } | 503 | } |
504 | 504 | ||
505 | public bool registerWithUserServer() | 505 | public bool registerWithUserServer () |
506 | { | 506 | { |
507 | Hashtable UserParams = new Hashtable(); | 507 | Hashtable UserParams = new Hashtable(); |
508 | // Login / Authentication | 508 | // Login / Authentication |
509 | 509 | ||
510 | if (m_cfg.HttpSSL) | 510 | if (m_cfg.HttpSSL) |
511 | { | 511 | { |
512 | UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; | 512 | UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; |
513 | } | 513 | } |
514 | else | 514 | else |
515 | { | 515 | { |
516 | UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; | 516 | UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; |
517 | } | 517 | } |
518 | 518 | ||
519 | UserParams["recvkey"] = m_cfg.UserRecvKey; | 519 | UserParams["recvkey"] = m_cfg.UserRecvKey; |
520 | UserParams["sendkey"] = m_cfg.UserRecvKey; | 520 | UserParams["sendkey"] = m_cfg.UserRecvKey; |
521 | 521 | ||
522 | // Package into an XMLRPC Request | 522 | // Package into an XMLRPC Request |
523 | ArrayList SendParams = new ArrayList(); | 523 | ArrayList SendParams = new ArrayList(); |
524 | SendParams.Add(UserParams); | 524 | SendParams.Add(UserParams); |
@@ -530,13 +530,12 @@ namespace OpenSim.Grid.MessagingServer | |||
530 | { | 530 | { |
531 | UserReq = new XmlRpcRequest("register_messageserver", SendParams); | 531 | UserReq = new XmlRpcRequest("register_messageserver", SendParams); |
532 | UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); | 532 | UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); |
533 | } | 533 | } catch (Exception ex) |
534 | catch (Exception ex) | ||
535 | { | 534 | { |
536 | m_log.Error("Unable to connect to grid. Grid server not running?"); | 535 | m_log.Error("Unable to connect to grid. Grid server not running?"); |
537 | throw (ex); | 536 | throw(ex); |
538 | } | 537 | } |
539 | Hashtable GridRespData = (Hashtable) UserResp.Value; | 538 | Hashtable GridRespData = (Hashtable)UserResp.Value; |
540 | Hashtable griddatahash = GridRespData; | 539 | Hashtable griddatahash = GridRespData; |
541 | 540 | ||
542 | // Process Response | 541 | // Process Response |
@@ -584,7 +583,7 @@ namespace OpenSim.Grid.MessagingServer | |||
584 | m_log.Error("Unable to connect to grid. Grid server not running?"); | 583 | m_log.Error("Unable to connect to grid. Grid server not running?"); |
585 | throw (ex); | 584 | throw (ex); |
586 | } | 585 | } |
587 | Hashtable UserRespData = (Hashtable) UserResp.Value; | 586 | Hashtable UserRespData = (Hashtable)UserResp.Value; |
588 | Hashtable userdatahash = UserRespData; | 587 | Hashtable userdatahash = UserRespData; |
589 | 588 | ||
590 | // Process Response | 589 | // Process Response |
@@ -600,4 +599,4 @@ namespace OpenSim.Grid.MessagingServer | |||
600 | 599 | ||
601 | #endregion | 600 | #endregion |
602 | } | 601 | } |
603 | } \ No newline at end of file | 602 | } |