diff options
author | Adam Frisby | 2008-05-01 16:41:01 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-01 16:41:01 +0000 |
commit | fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8 (patch) | |
tree | 90a4799fa43e3761ffbe669d1d87837933d8db53 /OpenSim/Grid/MessagingServer/MessageService.cs | |
parent | * Deletes my EventReader ScriptRewriter. It isn't required to rewrite the sc... (diff) | |
download | opensim-SC_OLD-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.zip opensim-SC_OLD-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.gz opensim-SC_OLD-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.bz2 opensim-SC_OLD-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.xz |
* Cleaning code still.
Diffstat (limited to 'OpenSim/Grid/MessagingServer/MessageService.cs')
-rw-r--r-- | OpenSim/Grid/MessagingServer/MessageService.cs | 151 |
1 files changed, 76 insertions, 75 deletions
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs index 50e06af..33c133d 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 MessageServerConfig m_cfg; | 48 | private readonly MessageServerConfig m_cfg; |
49 | private readonly Hashtable m_presence_BackReferences = new Hashtable(); | ||
49 | 50 | ||
50 | //A hashtable of all current presences this server knows about | 51 | //A hashtable of all current presences this server knows about |
51 | private Hashtable m_presences = new Hashtable(); | 52 | private readonly Hashtable m_presences = new Hashtable(); |
52 | 53 | ||
53 | //a hashtable of all current regions this server knows about | 54 | //a hashtable of all current regions this server knows about |
54 | private Hashtable m_regionInfoCache = new Hashtable(); | 55 | private readonly Hashtable m_regionInfoCache = new Hashtable(); |
55 | 56 | ||
56 | //A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing | 57 | //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 = new WaitCallback(friendlistupdater.go); | 129 | WaitCallback cb = 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 = new WaitCallback(friendlistupdater.go); | 150 | WaitCallback cb2 = 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 = new WaitCallback(friendlistupdater.go); | 269 | WaitCallback cb3 = 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,18 +298,17 @@ 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 | |||
308 | } | 307 | } |
309 | catch (WebException e) | 308 | catch (WebException e) |
310 | { | 309 | { |
311 | m_log.Warn("Error when trying to fetch Avatar's friends list: " + | 310 | m_log.Warn("Error when trying to fetch Avatar's friends list: " + |
312 | e.Message); | 311 | e.Message); |
313 | // Return Empty list (no friends) | 312 | // Return Empty list (no friends) |
314 | } | 313 | } |
315 | return buddylist; | 314 | return buddylist; |
@@ -323,16 +322,16 @@ namespace OpenSim.Grid.MessagingServer | |||
323 | public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) | 322 | public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) |
324 | { | 323 | { |
325 | List<FriendListItem> buddylist = new List<FriendListItem>(); | 324 | List<FriendListItem> buddylist = new List<FriendListItem>(); |
326 | int buddycount = Convert.ToInt32((string)data["avcount"]); | 325 | int buddycount = Convert.ToInt32((string) data["avcount"]); |
327 | 326 | ||
328 | for (int i = 0; i < buddycount; i++) | 327 | for (int i = 0; i < buddycount; i++) |
329 | { | 328 | { |
330 | FriendListItem buddylistitem = new FriendListItem(); | 329 | FriendListItem buddylistitem = new FriendListItem(); |
331 | 330 | ||
332 | buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]); | 331 | buddylistitem.FriendListOwner = new LLUUID((string) data["ownerID" + i]); |
333 | buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]); | 332 | buddylistitem.Friend = new LLUUID((string) data["friendID" + i]); |
334 | buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); | 333 | buddylistitem.FriendListOwnerPerms = (uint) Convert.ToInt32((string) data["ownerPerms" + i]); |
335 | buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); | 334 | buddylistitem.FriendPerms = (uint) Convert.ToInt32((string) data["friendPerms" + i]); |
336 | 335 | ||
337 | buddylist.Add(buddylistitem); | 336 | buddylist.Add(buddylistitem); |
338 | } | 337 | } |
@@ -350,7 +349,7 @@ namespace OpenSim.Grid.MessagingServer | |||
350 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) | 349 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) |
351 | { | 350 | { |
352 | m_log.Info("[LOGON]: User logged on, building indexes for user"); | 351 | m_log.Info("[LOGON]: User logged on, building indexes for user"); |
353 | Hashtable requestData = (Hashtable)request.Params[0]; | 352 | Hashtable requestData = (Hashtable) request.Params[0]; |
354 | 353 | ||
355 | //requestData["sendkey"] = serv.sendkey; | 354 | //requestData["sendkey"] = serv.sendkey; |
356 | //requestData["agentid"] = agentID.ToString(); | 355 | //requestData["agentid"] = agentID.ToString(); |
@@ -364,13 +363,13 @@ namespace OpenSim.Grid.MessagingServer | |||
364 | //requestData["lastname"] = lastname; | 363 | //requestData["lastname"] = lastname; |
365 | 364 | ||
366 | AgentCircuitData agentData = new AgentCircuitData(); | 365 | AgentCircuitData agentData = new AgentCircuitData(); |
367 | agentData.SessionID = new LLUUID((string)requestData["sessionid"]); | 366 | agentData.SessionID = new LLUUID((string) requestData["sessionid"]); |
368 | agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); | 367 | agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]); |
369 | agentData.firstname = (string)requestData["firstname"]; | 368 | agentData.firstname = (string) requestData["firstname"]; |
370 | agentData.lastname = (string)requestData["lastname"]; | 369 | agentData.lastname = (string) requestData["lastname"]; |
371 | agentData.AgentID = new LLUUID((string)requestData["agentid"]); | 370 | agentData.AgentID = new LLUUID((string) requestData["agentid"]); |
372 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | 371 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); |
373 | agentData.CapsPath = (string)requestData["caps_path"]; | 372 | agentData.CapsPath = (string) requestData["caps_path"]; |
374 | 373 | ||
375 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | 374 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) |
376 | { | 375 | { |
@@ -379,13 +378,13 @@ namespace OpenSim.Grid.MessagingServer | |||
379 | else | 378 | else |
380 | { | 379 | { |
381 | agentData.startpos = | 380 | agentData.startpos = |
382 | new LLVector3(Convert.ToUInt32(requestData["positionx"]), | 381 | new LLVector3(Convert.ToUInt32(requestData["positionx"]), |
383 | Convert.ToUInt32(requestData["positiony"]), | 382 | Convert.ToUInt32(requestData["positiony"]), |
384 | Convert.ToUInt32(requestData["positionz"])); | 383 | Convert.ToUInt32(requestData["positionz"])); |
385 | agentData.child = false; | 384 | agentData.child = false; |
386 | } | 385 | } |
387 | 386 | ||
388 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); | 387 | ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); |
389 | 388 | ||
390 | UserPresenceData up = new UserPresenceData(); | 389 | UserPresenceData up = new UserPresenceData(); |
391 | up.agentData = agentData; | 390 | up.agentData = agentData; |
@@ -398,7 +397,7 @@ namespace OpenSim.Grid.MessagingServer | |||
398 | 397 | ||
399 | return new XmlRpcResponse(); | 398 | return new XmlRpcResponse(); |
400 | } | 399 | } |
401 | 400 | ||
402 | /// <summary> | 401 | /// <summary> |
403 | /// The UserServer got a Logoff message | 402 | /// The UserServer got a Logoff message |
404 | /// Cleanup time for that user. Send out presence notifications | 403 | /// Cleanup time for that user. Send out presence notifications |
@@ -407,9 +406,9 @@ namespace OpenSim.Grid.MessagingServer | |||
407 | /// <returns></returns> | 406 | /// <returns></returns> |
408 | public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) | 407 | public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) |
409 | { | 408 | { |
410 | Hashtable requestData = (Hashtable)request.Params[0]; | 409 | Hashtable requestData = (Hashtable) request.Params[0]; |
411 | 410 | ||
412 | LLUUID AgentID = new LLUUID((string)requestData["agentid"]); | 411 | LLUUID AgentID = new LLUUID((string) requestData["agentid"]); |
413 | 412 | ||
414 | ProcessLogOff(AgentID); | 413 | ProcessLogOff(AgentID); |
415 | 414 | ||
@@ -431,9 +430,9 @@ namespace OpenSim.Grid.MessagingServer | |||
431 | RegionProfileData regionInfo = null; | 430 | RegionProfileData regionInfo = null; |
432 | if (m_regionInfoCache.Contains(regionhandle)) | 431 | if (m_regionInfoCache.Contains(regionhandle)) |
433 | { | 432 | { |
434 | regionInfo = (RegionProfileData)m_regionInfoCache[regionhandle]; | 433 | regionInfo = (RegionProfileData) m_regionInfoCache[regionhandle]; |
435 | } | 434 | } |
436 | else | 435 | else |
437 | { | 436 | { |
438 | regionInfo = RequestRegionInfo(regionhandle); | 437 | regionInfo = RequestRegionInfo(regionhandle); |
439 | } | 438 | } |
@@ -447,7 +446,8 @@ namespace OpenSim.Grid.MessagingServer | |||
447 | /// <param name="regionHandle"></param> | 446 | /// <param name="regionHandle"></param> |
448 | /// <returns></returns> | 447 | /// <returns></returns> |
449 | public RegionProfileData RequestRegionInfo(ulong regionHandle) | 448 | public RegionProfileData RequestRegionInfo(ulong regionHandle) |
450 | { RegionProfileData regionProfile = null; | 449 | { |
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.ToString() + | 497 | "Region lookup failed for: " + regionHandle + |
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,12 +530,13 @@ 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 | } catch (Exception ex) | 533 | } |
534 | catch (Exception ex) | ||
534 | { | 535 | { |
535 | m_log.Error("Unable to connect to grid. Grid server not running?"); | 536 | m_log.Error("Unable to connect to grid. Grid server not running?"); |
536 | throw(ex); | 537 | throw (ex); |
537 | } | 538 | } |
538 | Hashtable GridRespData = (Hashtable)UserResp.Value; | 539 | Hashtable GridRespData = (Hashtable) UserResp.Value; |
539 | Hashtable griddatahash = GridRespData; | 540 | Hashtable griddatahash = GridRespData; |
540 | 541 | ||
541 | // Process Response | 542 | // Process Response |
@@ -583,7 +584,7 @@ namespace OpenSim.Grid.MessagingServer | |||
583 | m_log.Error("Unable to connect to grid. Grid server not running?"); | 584 | m_log.Error("Unable to connect to grid. Grid server not running?"); |
584 | throw (ex); | 585 | throw (ex); |
585 | } | 586 | } |
586 | Hashtable UserRespData = (Hashtable)UserResp.Value; | 587 | Hashtable UserRespData = (Hashtable) UserResp.Value; |
587 | Hashtable userdatahash = UserRespData; | 588 | Hashtable userdatahash = UserRespData; |
588 | 589 | ||
589 | // Process Response | 590 | // Process Response |
@@ -599,4 +600,4 @@ namespace OpenSim.Grid.MessagingServer | |||
599 | 600 | ||
600 | #endregion | 601 | #endregion |
601 | } | 602 | } |
602 | } | 603 | } \ No newline at end of file |