aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
diff options
context:
space:
mode:
authorKitto Flora2010-09-06 21:45:17 +0000
committerKitto Flora2010-09-06 21:45:17 +0000
commitcfaefad754642677dbddfcbe743c3fa5e058785d (patch)
tree48ac26cc5289d8c0459837cd7d6936152216403b /OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
parentFalling animation fix, comment out instrumentation. (diff)
parentFix yet another cause of "Ghost attachments" (diff)
downloadopensim-SC_OLD-cfaefad754642677dbddfcbe743c3fa5e058785d.zip
opensim-SC_OLD-cfaefad754642677dbddfcbe743c3fa5e058785d.tar.gz
opensim-SC_OLD-cfaefad754642677dbddfcbe743c3fa5e058785d.tar.bz2
opensim-SC_OLD-cfaefad754642677dbddfcbe743c3fa5e058785d.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs50
1 files changed, 37 insertions, 13 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 4501937..6d3c64a 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -51,34 +51,49 @@ namespace OpenSim.Services.Connectors.Hypergrid
51 MethodBase.GetCurrentMethod().DeclaringType); 51 MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 string m_ServerURL; 53 string m_ServerURL;
54 Uri m_Uri;
55 public UserAgentServiceConnector(string url) 54 public UserAgentServiceConnector(string url)
56 { 55 {
57 m_ServerURL = url; 56 m_ServerURL = url;
57 // Doing this here, because XML-RPC or mono have some strong ideas about
58 // caching DNS translations.
58 try 59 try
59 { 60 {
60 m_Uri = new Uri(m_ServerURL); 61 Uri m_Uri = new Uri(m_ServerURL);
61 IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); 62 IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
62 m_ServerURL = "http://" + ip.ToString() + ":" + m_Uri.Port; 63 m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); ;
63 } 64 }
64 catch (Exception e) 65 catch (Exception e)
65 { 66 {
66 m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); 67 m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message);
67 } 68 }
69 m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL);
68 } 70 }
69 71
70 public UserAgentServiceConnector(IConfigSource config) 72 public UserAgentServiceConnector(IConfigSource config)
71 { 73 {
72 } 74 IConfig serviceConfig = config.Configs["UserAgentService"];
75 if (serviceConfig == null)
76 {
77 m_log.Error("[USER AGENT CONNECTOR]: UserAgentService missing from ini");
78 throw new Exception("UserAgent connector init error");
79 }
73 80
74 public bool LoginAgentToGrid(AgentCircuitData agent, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint ipaddress, out string reason) 81 string serviceURI = serviceConfig.GetString("UserAgentServerURI",
75 { 82 String.Empty);
76 // not available over remote calls 83
77 reason = "Method not available over remote calls"; 84 if (serviceURI == String.Empty)
78 return false; 85 {
86 m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService");
87 throw new Exception("UserAgent connector init error");
88 }
89 m_ServerURL = serviceURI;
90
91 m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL);
79 } 92 }
80 93
81 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) 94
95 // The Login service calls this interface with a non-null [client] ipaddress
96 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason)
82 { 97 {
83 reason = String.Empty; 98 reason = String.Empty;
84 99
@@ -89,7 +104,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
89 return false; 104 return false;
90 } 105 }
91 106
92 string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/"; 107 string uri = m_ServerURL + "/homeagent/" + aCircuit.AgentID + "/";
93 108
94 Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri); 109 Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri);
95 110
@@ -101,7 +116,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
101 //AgentCreateRequest.Headers.Add("Authorization", authKey); 116 //AgentCreateRequest.Headers.Add("Authorization", authKey);
102 117
103 // Fill it in 118 // Fill it in
104 OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination); 119 OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress);
105 120
106 string strBuffer = ""; 121 string strBuffer = "";
107 byte[] buffer = new byte[1]; 122 byte[] buffer = new byte[1];
@@ -198,7 +213,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
198 213
199 } 214 }
200 215
201 protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination) 216
217 // The simulators call this interface
218 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
219 {
220 return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason);
221 }
222
223 protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress)
202 { 224 {
203 OSDMap args = null; 225 OSDMap args = null;
204 try 226 try
@@ -216,6 +238,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
216 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); 238 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
217 args["destination_name"] = OSD.FromString(destination.RegionName); 239 args["destination_name"] = OSD.FromString(destination.RegionName);
218 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 240 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
241 if (ipaddress != null)
242 args["client_ip"] = OSD.FromString(ipaddress.Address.ToString());
219 243
220 return args; 244 return args;
221 } 245 }