diff options
author | Justin Clark-Casey (justincc) | 2014-02-13 23:55:38 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-02-14 00:01:12 +0000 |
commit | fc35b45e2176ee2dc8bf5627e84e463a2e9d3a52 (patch) | |
tree | 6f0e2c67c462543a052783cb1390070b7b58fe96 /OpenSim | |
parent | If a caller tries to queue a CAPs message to a scene presence that has no eve... (diff) | |
download | opensim-SC_OLD-fc35b45e2176ee2dc8bf5627e84e463a2e9d3a52.zip opensim-SC_OLD-fc35b45e2176ee2dc8bf5627e84e463a2e9d3a52.tar.gz opensim-SC_OLD-fc35b45e2176ee2dc8bf5627e84e463a2e9d3a52.tar.bz2 opensim-SC_OLD-fc35b45e2176ee2dc8bf5627e84e463a2e9d3a52.tar.xz |
If calls to UserAgentServiceConnector fail then throw an exception. This lets the caller decide whether to discard the error or not.
This is Oren Hurvitz's 0001 patch from http://opensimulator.org/mantis/view.php?id=6956 but I ended up doing some tweaking to resolve patch application issues.
Diffstat (limited to '')
8 files changed, 193 insertions, 300 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index 7bf19c2..d46cb55 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs | |||
@@ -282,7 +282,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
282 | string uasURL = circuit.ServiceURLs["HomeURI"].ToString(); | 282 | string uasURL = circuit.ServiceURLs["HomeURI"].ToString(); |
283 | m_log.DebugFormat("[HG MESSAGE TRANSFER]: getting UUI of user {0} from {1}", toAgent, uasURL); | 283 | m_log.DebugFormat("[HG MESSAGE TRANSFER]: getting UUI of user {0} from {1}", toAgent, uasURL); |
284 | UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uasURL); | 284 | UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uasURL); |
285 | return uasConn.GetUUI(fromAgent, toAgent); | 285 | |
286 | string agentUUI = string.Empty; | ||
287 | try | ||
288 | { | ||
289 | agentUUI = uasConn.GetUUI(fromAgent, toAgent); | ||
290 | } | ||
291 | catch (Exception e) { | ||
292 | m_log.Warn("[HG MESSAGE TRANSFER]: GetUUI call failed ", e); | ||
293 | } | ||
294 | |||
295 | return agentUUI; | ||
286 | } | 296 | } |
287 | } | 297 | } |
288 | } | 298 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 9ae7452..ed8864d 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs | |||
@@ -1164,7 +1164,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles | |||
1164 | 1164 | ||
1165 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(home_url); | 1165 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(home_url); |
1166 | 1166 | ||
1167 | Dictionary<string, object> account = uConn.GetUserInfo(userID); | 1167 | Dictionary<string, object> account; |
1168 | try | ||
1169 | { | ||
1170 | account = uConn.GetUserInfo(userID); | ||
1171 | } | ||
1172 | catch (Exception e) | ||
1173 | { | ||
1174 | m_log.Warn("[PROFILES]: GetUserInfo call failed ", e); | ||
1175 | account = new Dictionary<string, object>(); | ||
1176 | } | ||
1168 | 1177 | ||
1169 | if (account.Count > 0) | 1178 | if (account.Count > 0) |
1170 | { | 1179 | { |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 04a0db6..b752639 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -462,7 +462,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
462 | 462 | ||
463 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); | 463 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); |
464 | Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; | 464 | Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; |
465 | GridRegion finalDestination = userAgentService.GetHomeRegion(aCircuit.AgentID, out position, out lookAt); | 465 | |
466 | GridRegion finalDestination = null; | ||
467 | try | ||
468 | { | ||
469 | finalDestination = userAgentService.GetHomeRegion(aCircuit.AgentID, out position, out lookAt); | ||
470 | } | ||
471 | catch (Exception e) | ||
472 | { | ||
473 | m_log.Warn("[HG ENTITY TRANSFER MODULE]: GetHomeRegion call failed ", e); | ||
474 | } | ||
475 | |||
466 | if (finalDestination == null) | 476 | if (finalDestination == null) |
467 | { | 477 | { |
468 | client.SendTeleportFailed("Your home region could not be found"); | 478 | client.SendTeleportFailed("Your home region could not be found"); |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs index 245c808..b568857 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs | |||
@@ -130,7 +130,17 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
130 | } | 130 | } |
131 | 131 | ||
132 | UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr); | 132 | UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr); |
133 | UUID userID = uasConn.GetUUID(names[0], names[1]); | 133 | |
134 | UUID userID = UUID.Zero; | ||
135 | try | ||
136 | { | ||
137 | userID = uasConn.GetUUID(names[0], names[1]); | ||
138 | } | ||
139 | catch (Exception e) | ||
140 | { | ||
141 | m_log.Warn("[USER MANAGEMENT MODULE]: GetUUID call failed ", e); | ||
142 | } | ||
143 | |||
134 | if (!userID.Equals(UUID.Zero)) | 144 | if (!userID.Equals(UUID.Zero)) |
135 | { | 145 | { |
136 | UserData ud = new UserData(); | 146 | UserData ud = new UserData(); |
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 3fb5195..d8b415e 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -473,7 +473,16 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
473 | // serverType, userdata.HomeURL, userID); | 473 | // serverType, userdata.HomeURL, userID); |
474 | 474 | ||
475 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); | 475 | UserAgentServiceConnector uConn = new UserAgentServiceConnector(userdata.HomeURL); |
476 | userdata.ServerURLs = uConn.GetServerURLs(userID); | 476 | try |
477 | { | ||
478 | userdata.ServerURLs = uConn.GetServerURLs(userID); | ||
479 | } | ||
480 | catch (Exception e) | ||
481 | { | ||
482 | m_log.Warn("[USER MANAGEMENT MODULE]: GetServerURLs call failed ", e); | ||
483 | userdata.ServerURLs = new Dictionary<string, object>(); | ||
484 | } | ||
485 | |||
477 | if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) | 486 | if (userdata.ServerURLs != null && userdata.ServerURLs.ContainsKey(serverType) && userdata.ServerURLs[serverType] != null) |
478 | return userdata.ServerURLs[serverType].ToString(); | 487 | return userdata.ServerURLs[serverType].ToString(); |
479 | } | 488 | } |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 2511c08..cbd62cb 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -78,7 +78,8 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
78 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); | 78 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); |
79 | } | 79 | } |
80 | } | 80 | } |
81 | m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL); | 81 | |
82 | //m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL); | ||
82 | } | 83 | } |
83 | 84 | ||
84 | public UserAgentServiceConnector(IConfigSource config) | 85 | public UserAgentServiceConnector(IConfigSource config) |
@@ -190,96 +191,99 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
190 | // no-op | 191 | // no-op |
191 | } | 192 | } |
192 | 193 | ||
193 | public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) | 194 | private Hashtable CallServer(string methodName, Hashtable hash) |
194 | { | 195 | { |
195 | position = Vector3.UnitY; lookAt = Vector3.UnitY; | ||
196 | |||
197 | Hashtable hash = new Hashtable(); | ||
198 | hash["userID"] = userID.ToString(); | ||
199 | |||
200 | IList paramList = new ArrayList(); | 196 | IList paramList = new ArrayList(); |
201 | paramList.Add(hash); | 197 | paramList.Add(hash); |
202 | 198 | ||
203 | XmlRpcRequest request = new XmlRpcRequest("get_home_region", paramList); | 199 | XmlRpcRequest request = new XmlRpcRequest(methodName, paramList); |
200 | |||
201 | // Send and get reply | ||
204 | XmlRpcResponse response = null; | 202 | XmlRpcResponse response = null; |
205 | try | 203 | try |
206 | { | 204 | { |
207 | response = request.Send(m_ServerURL, 10000); | 205 | response = request.Send(m_ServerURL, 10000); |
208 | } | 206 | } |
209 | catch (Exception) | 207 | catch (Exception e) |
210 | { | 208 | { |
211 | return null; | 209 | m_log.WarnFormat("[USER AGENT CONNECTOR]: {0} call to {1} failed: {2}", methodName, m_ServerURL, e.Message); |
210 | throw; | ||
212 | } | 211 | } |
213 | 212 | ||
214 | if (response.IsFault) | 213 | if (response.IsFault) |
215 | { | 214 | { |
216 | return null; | 215 | throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned an error: {2}", methodName, m_ServerURL, response.FaultString)); |
217 | } | 216 | } |
218 | 217 | ||
219 | hash = (Hashtable)response.Value; | 218 | hash = (Hashtable)response.Value; |
220 | //foreach (Object o in hash) | 219 | |
221 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | 220 | if (hash == null) |
222 | try | ||
223 | { | 221 | { |
224 | bool success = false; | 222 | throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned null", methodName, m_ServerURL)); |
225 | Boolean.TryParse((string)hash["result"], out success); | 223 | } |
226 | if (success) | ||
227 | { | ||
228 | GridRegion region = new GridRegion(); | ||
229 | 224 | ||
230 | UUID.TryParse((string)hash["uuid"], out region.RegionID); | 225 | return hash; |
231 | //m_log.Debug(">> HERE, uuid: " + region.RegionID); | 226 | } |
232 | int n = 0; | ||
233 | if (hash["x"] != null) | ||
234 | { | ||
235 | Int32.TryParse((string)hash["x"], out n); | ||
236 | region.RegionLocX = n; | ||
237 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | ||
238 | } | ||
239 | if (hash["y"] != null) | ||
240 | { | ||
241 | Int32.TryParse((string)hash["y"], out n); | ||
242 | region.RegionLocY = n; | ||
243 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | ||
244 | } | ||
245 | if (hash["region_name"] != null) | ||
246 | { | ||
247 | region.RegionName = (string)hash["region_name"]; | ||
248 | //m_log.Debug(">> HERE, name: " + region.RegionName); | ||
249 | } | ||
250 | if (hash["hostname"] != null) | ||
251 | region.ExternalHostName = (string)hash["hostname"]; | ||
252 | if (hash["http_port"] != null) | ||
253 | { | ||
254 | uint p = 0; | ||
255 | UInt32.TryParse((string)hash["http_port"], out p); | ||
256 | region.HttpPort = p; | ||
257 | } | ||
258 | if (hash.ContainsKey("server_uri") && hash["server_uri"] != null) | ||
259 | region.ServerURI = (string)hash["server_uri"]; | ||
260 | 227 | ||
261 | if (hash["internal_port"] != null) | 228 | public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) |
262 | { | 229 | { |
263 | int p = 0; | 230 | position = Vector3.UnitY; lookAt = Vector3.UnitY; |
264 | Int32.TryParse((string)hash["internal_port"], out p); | ||
265 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); | ||
266 | } | ||
267 | if (hash["position"] != null) | ||
268 | Vector3.TryParse((string)hash["position"], out position); | ||
269 | if (hash["lookAt"] != null) | ||
270 | Vector3.TryParse((string)hash["lookAt"], out lookAt); | ||
271 | 231 | ||
272 | // Successful return | 232 | Hashtable hash = new Hashtable(); |
273 | return region; | 233 | hash["userID"] = userID.ToString(); |
274 | } | ||
275 | 234 | ||
235 | hash = CallServer("get_home_region", hash); | ||
236 | |||
237 | bool success; | ||
238 | if (!Boolean.TryParse((string)hash["result"], out success) || !success) | ||
239 | return null; | ||
240 | |||
241 | GridRegion region = new GridRegion(); | ||
242 | |||
243 | UUID.TryParse((string)hash["uuid"], out region.RegionID); | ||
244 | //m_log.Debug(">> HERE, uuid: " + region.RegionID); | ||
245 | int n = 0; | ||
246 | if (hash["x"] != null) | ||
247 | { | ||
248 | Int32.TryParse((string)hash["x"], out n); | ||
249 | region.RegionLocX = n; | ||
250 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | ||
276 | } | 251 | } |
277 | catch (Exception) | 252 | if (hash["y"] != null) |
278 | { | 253 | { |
279 | return null; | 254 | Int32.TryParse((string)hash["y"], out n); |
255 | region.RegionLocY = n; | ||
256 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | ||
257 | } | ||
258 | if (hash["region_name"] != null) | ||
259 | { | ||
260 | region.RegionName = (string)hash["region_name"]; | ||
261 | //m_log.Debug(">> HERE, name: " + region.RegionName); | ||
280 | } | 262 | } |
263 | if (hash["hostname"] != null) | ||
264 | region.ExternalHostName = (string)hash["hostname"]; | ||
265 | if (hash["http_port"] != null) | ||
266 | { | ||
267 | uint p = 0; | ||
268 | UInt32.TryParse((string)hash["http_port"], out p); | ||
269 | region.HttpPort = p; | ||
270 | } | ||
271 | if (hash.ContainsKey("server_uri") && hash["server_uri"] != null) | ||
272 | region.ServerURI = (string)hash["server_uri"]; | ||
281 | 273 | ||
282 | return null; | 274 | if (hash["internal_port"] != null) |
275 | { | ||
276 | int p = 0; | ||
277 | Int32.TryParse((string)hash["internal_port"], out p); | ||
278 | region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); | ||
279 | } | ||
280 | if (hash["position"] != null) | ||
281 | Vector3.TryParse((string)hash["position"], out position); | ||
282 | if (hash["lookAt"] != null) | ||
283 | Vector3.TryParse((string)hash["lookAt"], out lookAt); | ||
284 | |||
285 | // Successful return | ||
286 | return region; | ||
283 | } | 287 | } |
284 | 288 | ||
285 | public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) | 289 | public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) |
@@ -488,51 +492,17 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
488 | Hashtable hash = new Hashtable(); | 492 | Hashtable hash = new Hashtable(); |
489 | hash["userID"] = userID.ToString(); | 493 | hash["userID"] = userID.ToString(); |
490 | 494 | ||
491 | IList paramList = new ArrayList(); | 495 | hash = CallServer("get_user_info", hash); |
492 | paramList.Add(hash); | ||
493 | |||
494 | XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList); | ||
495 | 496 | ||
496 | Dictionary<string, object> info = new Dictionary<string, object>(); | 497 | Dictionary<string, object> info = new Dictionary<string, object>(); |
497 | XmlRpcResponse response = null; | ||
498 | try | ||
499 | { | ||
500 | response = request.Send(m_ServerURL, 10000); | ||
501 | } | ||
502 | catch | ||
503 | { | ||
504 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL); | ||
505 | return info; | ||
506 | } | ||
507 | |||
508 | if (response.IsFault) | ||
509 | { | ||
510 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString); | ||
511 | return info; | ||
512 | } | ||
513 | 498 | ||
514 | hash = (Hashtable)response.Value; | 499 | foreach (object key in hash.Keys) |
515 | try | ||
516 | { | 500 | { |
517 | if (hash == null) | 501 | if (hash[key] != null) |
518 | { | 502 | { |
519 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | 503 | info.Add(key.ToString(), hash[key]); |
520 | return info; | ||
521 | } | ||
522 | |||
523 | // Here is the actual response | ||
524 | foreach (object key in hash.Keys) | ||
525 | { | ||
526 | if (hash[key] != null) | ||
527 | { | ||
528 | info.Add(key.ToString(), hash[key]); | ||
529 | } | ||
530 | } | 504 | } |
531 | } | 505 | } |
532 | catch | ||
533 | { | ||
534 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); | ||
535 | } | ||
536 | 506 | ||
537 | return info; | 507 | return info; |
538 | } | 508 | } |
@@ -542,60 +512,16 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
542 | Hashtable hash = new Hashtable(); | 512 | Hashtable hash = new Hashtable(); |
543 | hash["userID"] = userID.ToString(); | 513 | hash["userID"] = userID.ToString(); |
544 | 514 | ||
545 | IList paramList = new ArrayList(); | 515 | hash = CallServer("get_server_urls", hash); |
546 | paramList.Add(hash); | 516 | |
547 | 517 | Dictionary<string, object> serverURLs = new Dictionary<string, object>(); | |
548 | XmlRpcRequest request = new XmlRpcRequest("get_server_urls", paramList); | 518 | foreach (object key in hash.Keys) |
549 | // string reason = string.Empty; | ||
550 | |||
551 | // Send and get reply | ||
552 | Dictionary<string, object> serverURLs = new Dictionary<string,object>(); | ||
553 | XmlRpcResponse response = null; | ||
554 | try | ||
555 | { | ||
556 | response = request.Send(m_ServerURL, 10000); | ||
557 | } | ||
558 | catch | ||
559 | { | ||
560 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetServerURLs for user {1}", m_ServerURL, userID); | ||
561 | // reason = "Exception: " + e.Message; | ||
562 | return serverURLs; | ||
563 | } | ||
564 | |||
565 | if (response.IsFault) | ||
566 | { | 519 | { |
567 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString); | 520 | if (key is string && ((string)key).StartsWith("SRV_") && hash[key] != null) |
568 | // reason = "XMLRPC Fault"; | ||
569 | return serverURLs; | ||
570 | } | ||
571 | |||
572 | hash = (Hashtable)response.Value; | ||
573 | //foreach (Object o in hash) | ||
574 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
575 | try | ||
576 | { | ||
577 | if (hash == null) | ||
578 | { | ||
579 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetServerURLs Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
580 | // reason = "Internal error 1"; | ||
581 | return serverURLs; | ||
582 | } | ||
583 | |||
584 | // Here is the actual response | ||
585 | foreach (object key in hash.Keys) | ||
586 | { | 521 | { |
587 | if (key is string && ((string)key).StartsWith("SRV_") && hash[key] != null) | 522 | string serverType = key.ToString().Substring(4); // remove "SRV_" |
588 | { | 523 | serverURLs.Add(serverType, hash[key].ToString()); |
589 | string serverType = key.ToString().Substring(4); // remove "SRV_" | ||
590 | serverURLs.Add(serverType, hash[key].ToString()); | ||
591 | } | ||
592 | } | 524 | } |
593 | |||
594 | } | ||
595 | catch | ||
596 | { | ||
597 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); | ||
598 | // reason = "Exception: " + e.Message; | ||
599 | } | 525 | } |
600 | 526 | ||
601 | return serverURLs; | 527 | return serverURLs; |
@@ -606,55 +532,13 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
606 | Hashtable hash = new Hashtable(); | 532 | Hashtable hash = new Hashtable(); |
607 | hash["userID"] = userID.ToString(); | 533 | hash["userID"] = userID.ToString(); |
608 | 534 | ||
609 | IList paramList = new ArrayList(); | 535 | hash = CallServer("locate_user", hash); |
610 | paramList.Add(hash); | ||
611 | 536 | ||
612 | XmlRpcRequest request = new XmlRpcRequest("locate_user", paramList); | ||
613 | // string reason = string.Empty; | ||
614 | |||
615 | // Send and get reply | ||
616 | string url = string.Empty; | 537 | string url = string.Empty; |
617 | XmlRpcResponse response = null; | ||
618 | try | ||
619 | { | ||
620 | response = request.Send(m_ServerURL, 10000); | ||
621 | } | ||
622 | catch | ||
623 | { | ||
624 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for LocateUser", m_ServerURL); | ||
625 | // reason = "Exception: " + e.Message; | ||
626 | return url; | ||
627 | } | ||
628 | |||
629 | if (response.IsFault) | ||
630 | { | ||
631 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for LocateUser returned an error: {1}", m_ServerURL, response.FaultString); | ||
632 | // reason = "XMLRPC Fault"; | ||
633 | return url; | ||
634 | } | ||
635 | |||
636 | hash = (Hashtable)response.Value; | ||
637 | //foreach (Object o in hash) | ||
638 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
639 | try | ||
640 | { | ||
641 | if (hash == null) | ||
642 | { | ||
643 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: LocateUser Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
644 | // reason = "Internal error 1"; | ||
645 | return url; | ||
646 | } | ||
647 | 538 | ||
648 | // Here's the actual response | 539 | // Here's the actual response |
649 | if (hash.ContainsKey("URL")) | 540 | if (hash.ContainsKey("URL")) |
650 | url = hash["URL"].ToString(); | 541 | url = hash["URL"].ToString(); |
651 | |||
652 | } | ||
653 | catch | ||
654 | { | ||
655 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response."); | ||
656 | // reason = "Exception: " + e.Message; | ||
657 | } | ||
658 | 542 | ||
659 | return url; | 543 | return url; |
660 | } | 544 | } |
@@ -665,55 +549,13 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
665 | hash["userID"] = userID.ToString(); | 549 | hash["userID"] = userID.ToString(); |
666 | hash["targetUserID"] = targetUserID.ToString(); | 550 | hash["targetUserID"] = targetUserID.ToString(); |
667 | 551 | ||
668 | IList paramList = new ArrayList(); | 552 | hash = CallServer("get_uui", hash); |
669 | paramList.Add(hash); | ||
670 | 553 | ||
671 | XmlRpcRequest request = new XmlRpcRequest("get_uui", paramList); | ||
672 | // string reason = string.Empty; | ||
673 | |||
674 | // Send and get reply | ||
675 | string uui = string.Empty; | 554 | string uui = string.Empty; |
676 | XmlRpcResponse response = null; | ||
677 | try | ||
678 | { | ||
679 | response = request.Send(m_ServerURL, 10000); | ||
680 | } | ||
681 | catch | ||
682 | { | ||
683 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUI", m_ServerURL); | ||
684 | // reason = "Exception: " + e.Message; | ||
685 | return uui; | ||
686 | } | ||
687 | |||
688 | if (response.IsFault) | ||
689 | { | ||
690 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUI returned an error: {1}", m_ServerURL, response.FaultString); | ||
691 | // reason = "XMLRPC Fault"; | ||
692 | return uui; | ||
693 | } | ||
694 | 555 | ||
695 | hash = (Hashtable)response.Value; | 556 | // Here's the actual response |
696 | //foreach (Object o in hash) | 557 | if (hash.ContainsKey("UUI")) |
697 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | 558 | uui = hash["UUI"].ToString(); |
698 | try | ||
699 | { | ||
700 | if (hash == null) | ||
701 | { | ||
702 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUI Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
703 | // reason = "Internal error 1"; | ||
704 | return uui; | ||
705 | } | ||
706 | |||
707 | // Here's the actual response | ||
708 | if (hash.ContainsKey("UUI")) | ||
709 | uui = hash["UUI"].ToString(); | ||
710 | |||
711 | } | ||
712 | catch | ||
713 | { | ||
714 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetUUI response."); | ||
715 | // reason = "Exception: " + e.Message; | ||
716 | } | ||
717 | 559 | ||
718 | return uui; | 560 | return uui; |
719 | } | 561 | } |
@@ -724,54 +566,17 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
724 | hash["first"] = first; | 566 | hash["first"] = first; |
725 | hash["last"] = last; | 567 | hash["last"] = last; |
726 | 568 | ||
727 | IList paramList = new ArrayList(); | 569 | hash = CallServer("get_uuid", hash); |
728 | paramList.Add(hash); | ||
729 | |||
730 | XmlRpcRequest request = new XmlRpcRequest("get_uuid", paramList); | ||
731 | // string reason = string.Empty; | ||
732 | |||
733 | // Send and get reply | ||
734 | UUID uuid = UUID.Zero; | ||
735 | XmlRpcResponse response = null; | ||
736 | try | ||
737 | { | ||
738 | response = request.Send(m_ServerURL, 10000); | ||
739 | } | ||
740 | catch | ||
741 | { | ||
742 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUID", m_ServerURL); | ||
743 | // reason = "Exception: " + e.Message; | ||
744 | return uuid; | ||
745 | } | ||
746 | 570 | ||
747 | if (response.IsFault) | 571 | if (!hash.ContainsKey("UUID")) |
748 | { | 572 | { |
749 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUID returned an error: {1}", m_ServerURL, response.FaultString); | 573 | throw new Exception(string.Format("[USER AGENT CONNECTOR]: get_uuid call to {0} didn't return a UUID", m_ServerURL)); |
750 | // reason = "XMLRPC Fault"; | ||
751 | return uuid; | ||
752 | } | 574 | } |
753 | 575 | ||
754 | hash = (Hashtable)response.Value; | 576 | UUID uuid; |
755 | //foreach (Object o in hash) | 577 | if (!UUID.TryParse(hash["UUID"].ToString(), out uuid)) |
756 | // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); | ||
757 | try | ||
758 | { | ||
759 | if (hash == null) | ||
760 | { | ||
761 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUDI Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
762 | // reason = "Internal error 1"; | ||
763 | return uuid; | ||
764 | } | ||
765 | |||
766 | // Here's the actual response | ||
767 | if (hash.ContainsKey("UUID")) | ||
768 | UUID.TryParse(hash["UUID"].ToString(), out uuid); | ||
769 | |||
770 | } | ||
771 | catch | ||
772 | { | 578 | { |
773 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on UUID response."); | 579 | throw new Exception(string.Format("[USER AGENT CONNECTOR]: get_uuid call to {0} returned an invalid UUID: {1}", m_ServerURL, hash["UUID"].ToString())); |
774 | // reason = "Exception: " + e.Message; | ||
775 | } | 580 | } |
776 | 581 | ||
777 | return uuid; | 582 | return uuid; |
diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index e8d7cca..9b7b278 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs | |||
@@ -215,7 +215,15 @@ namespace OpenSim.Services.HypergridService | |||
215 | { | 215 | { |
216 | // Let's check with the UAS if the user is elsewhere | 216 | // Let's check with the UAS if the user is elsewhere |
217 | m_log.DebugFormat("[HG IM SERVICE]: User is not present. Checking location with User Agent service"); | 217 | m_log.DebugFormat("[HG IM SERVICE]: User is not present. Checking location with User Agent service"); |
218 | url = m_UserAgentService.LocateUser(toAgentID); | 218 | try |
219 | { | ||
220 | url = m_UserAgentService.LocateUser(toAgentID); | ||
221 | } | ||
222 | catch (Exception e) | ||
223 | { | ||
224 | m_log.Warn("[HG IM SERVICE]: LocateUser call failed ", e); | ||
225 | url = string.Empty; | ||
226 | } | ||
219 | } | 227 | } |
220 | 228 | ||
221 | // check if we've tried this before.. | 229 | // check if we've tried this before.. |
diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index 05e175a..bece4c7 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -47,15 +47,47 @@ namespace OpenSim.Services.Interfaces | |||
47 | { | 47 | { |
48 | bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason); | 48 | bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, bool fromLogin, out string reason); |
49 | void LogoutAgent(UUID userID, UUID sessionID); | 49 | void LogoutAgent(UUID userID, UUID sessionID); |
50 | |||
51 | /// <summary> | ||
52 | /// Returns the home region of a remote user. | ||
53 | /// </summary> | ||
54 | /// <returns>On success: the user's home region. If the user doesn't exist: null.</returns> | ||
55 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
50 | GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); | 56 | GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); |
57 | |||
58 | /// <summary> | ||
59 | /// Returns the Server URLs of a remote user. | ||
60 | /// </summary> | ||
61 | /// <returns>On success: the user's Server URLs. If the user doesn't exist: an empty dictionary.</returns> | ||
62 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
51 | Dictionary<string, object> GetServerURLs(UUID userID); | 63 | Dictionary<string, object> GetServerURLs(UUID userID); |
52 | Dictionary<string,object> GetUserInfo(UUID userID); | ||
53 | 64 | ||
65 | /// <summary> | ||
66 | /// Returns the UserInfo of a remote user. | ||
67 | /// </summary> | ||
68 | /// <returns>On success: the user's UserInfo. If the user doesn't exist: an empty dictionary.</returns> | ||
69 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
70 | Dictionary<string, object> GetUserInfo(UUID userID); | ||
71 | |||
72 | /// <summary> | ||
73 | /// Returns the current location of a remote user. | ||
74 | /// </summary> | ||
75 | /// <returns>On success: the user's Server URLs. If the user doesn't exist: "".</returns> | ||
76 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
54 | string LocateUser(UUID userID); | 77 | string LocateUser(UUID userID); |
55 | // Tries to get the universal user identifier for the targetUserId | 78 | |
56 | // on behalf of the userID | 79 | /// <summary> |
80 | /// Returns the Universal User Identifier for 'targetUserID' on behalf of 'userID'. | ||
81 | /// </summary> | ||
82 | /// <returns>On success: the user's UUI. If the user doesn't exist: "".</returns> | ||
83 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
57 | string GetUUI(UUID userID, UUID targetUserID); | 84 | string GetUUI(UUID userID, UUID targetUserID); |
58 | 85 | ||
86 | /// <summary> | ||
87 | /// Returns the remote user that has the given name. | ||
88 | /// </summary> | ||
89 | /// <returns>On success: the user's UUID. If the user doesn't exist: UUID.Zero.</returns> | ||
90 | /// <remarks>Throws an exception if an error occurs (e.g., can't contact the server).</remarks> | ||
59 | UUID GetUUID(String first, String last); | 91 | UUID GetUUID(String first, String last); |
60 | 92 | ||
61 | // Returns the local friends online | 93 | // Returns the local friends online |