diff options
author | Dan Lake | 2012-01-03 16:52:53 -0800 |
---|---|---|
committer | Dan Lake | 2012-01-03 16:52:53 -0800 |
commit | ecf9824b63d181bd4e64bd5cb0ff37b952669bb9 (patch) | |
tree | 269207a773c6bd1fd8383885e0c5649d70b34a62 /OpenSim/Services/Connectors/Hypergrid | |
parent | Access to these static methods to serialize objects are useful outside of ser... (diff) | |
parent | Update C5.dll to version 1.1.1 from 1.1.0 (diff) | |
download | opensim-SC_OLD-ecf9824b63d181bd4e64bd5cb0ff37b952669bb9.zip opensim-SC_OLD-ecf9824b63d181bd4e64bd5cb0ff37b952669bb9.tar.gz opensim-SC_OLD-ecf9824b63d181bd4e64bd5cb0ff37b952669bb9.tar.bz2 opensim-SC_OLD-ecf9824b63d181bd4e64bd5cb0ff37b952669bb9.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Services/Connectors/Hypergrid')
-rw-r--r-- | OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs | 27 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | 57 |
2 files changed, 82 insertions, 2 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs index 7cfd6e8..c030bca 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs | |||
@@ -47,13 +47,36 @@ namespace OpenSim.Services.Connectors | |||
47 | 47 | ||
48 | public HeloServicesConnector(string serverURI) | 48 | public HeloServicesConnector(string serverURI) |
49 | { | 49 | { |
50 | m_ServerURI = serverURI.TrimEnd('/'); | 50 | if (!serverURI.EndsWith("=")) |
51 | m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; | ||
52 | else | ||
53 | { | ||
54 | // Simian sends malformed urls like this: | ||
55 | // http://valley.virtualportland.org/simtest/Grid/?id= | ||
56 | // | ||
57 | try | ||
58 | { | ||
59 | Uri uri = new Uri(serverURI + "xxx"); | ||
60 | if (uri.Query == string.Empty) | ||
61 | m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; | ||
62 | else | ||
63 | { | ||
64 | serverURI = serverURI + "xxx"; | ||
65 | m_ServerURI = serverURI.Replace(uri.Query, ""); | ||
66 | m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/"; | ||
67 | } | ||
68 | } | ||
69 | catch (UriFormatException e) | ||
70 | { | ||
71 | m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI); | ||
72 | } | ||
73 | } | ||
51 | } | 74 | } |
52 | 75 | ||
53 | 76 | ||
54 | public virtual string Helo() | 77 | public virtual string Helo() |
55 | { | 78 | { |
56 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo"); | 79 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); |
57 | // Eventually we need to switch to HEAD | 80 | // Eventually we need to switch to HEAD |
58 | /* req.Method = "HEAD"; */ | 81 | /* req.Method = "HEAD"; */ |
59 | 82 | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 0c55c2e..5b27cf6 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -334,6 +334,9 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
334 | UInt32.TryParse((string)hash["http_port"], out p); | 334 | UInt32.TryParse((string)hash["http_port"], out p); |
335 | region.HttpPort = p; | 335 | region.HttpPort = p; |
336 | } | 336 | } |
337 | if (hash.ContainsKey("server_uri") && hash["server_uri"] != null) | ||
338 | region.ServerURI = (string)hash["server_uri"]; | ||
339 | |||
337 | if (hash["internal_port"] != null) | 340 | if (hash["internal_port"] != null) |
338 | { | 341 | { |
339 | int p = 0; | 342 | int p = 0; |
@@ -558,6 +561,60 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
558 | return online; | 561 | return online; |
559 | } | 562 | } |
560 | 563 | ||
564 | public Dictionary<string,object> GetUserInfo (UUID userID) | ||
565 | { | ||
566 | Hashtable hash = new Hashtable(); | ||
567 | hash["userID"] = userID.ToString(); | ||
568 | |||
569 | IList paramList = new ArrayList(); | ||
570 | paramList.Add(hash); | ||
571 | |||
572 | XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList); | ||
573 | |||
574 | Dictionary<string, object> info = new Dictionary<string, object>(); | ||
575 | XmlRpcResponse response = null; | ||
576 | try | ||
577 | { | ||
578 | response = request.Send(m_ServerURL, 10000); | ||
579 | } | ||
580 | catch | ||
581 | { | ||
582 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL); | ||
583 | return info; | ||
584 | } | ||
585 | |||
586 | if (response.IsFault) | ||
587 | { | ||
588 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString); | ||
589 | return info; | ||
590 | } | ||
591 | |||
592 | hash = (Hashtable)response.Value; | ||
593 | try | ||
594 | { | ||
595 | if (hash == null) | ||
596 | { | ||
597 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL); | ||
598 | return info; | ||
599 | } | ||
600 | |||
601 | // Here is the actual response | ||
602 | foreach (object key in hash.Keys) | ||
603 | { | ||
604 | if (hash[key] != null) | ||
605 | { | ||
606 | info.Add(key.ToString(), hash[key]); | ||
607 | } | ||
608 | } | ||
609 | } | ||
610 | catch | ||
611 | { | ||
612 | m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); | ||
613 | } | ||
614 | |||
615 | return info; | ||
616 | } | ||
617 | |||
561 | public Dictionary<string, object> GetServerURLs(UUID userID) | 618 | public Dictionary<string, object> GetServerURLs(UUID userID) |
562 | { | 619 | { |
563 | Hashtable hash = new Hashtable(); | 620 | Hashtable hash = new Hashtable(); |