aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Hypergrid
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Services/Connectors/Hypergrid
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Services/Connectors/Hypergrid')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs99
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs57
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs591
4 files changed, 227 insertions, 522 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 5bcff48..b1663ee 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -53,7 +53,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
53 53
54 private IAssetService m_AssetService; 54 private IAssetService m_AssetService;
55 55
56 public GatekeeperServiceConnector() : base() 56 public GatekeeperServiceConnector()
57 : base()
57 { 58 {
58 } 59 }
59 60
@@ -123,11 +124,13 @@ namespace OpenSim.Services.Connectors.Hypergrid
123 realHandle = Convert.ToUInt64((string)hash["handle"]); 124 realHandle = Convert.ToUInt64((string)hash["handle"]);
124 //m_log.Debug(">> HERE, realHandle: " + realHandle); 125 //m_log.Debug(">> HERE, realHandle: " + realHandle);
125 } 126 }
126 if (hash["region_image"] != null) { 127 if (hash["region_image"] != null)
128 {
127 imageURL = (string)hash["region_image"]; 129 imageURL = (string)hash["region_image"];
128 //m_log.Debug(">> HERE, imageURL: " + imageURL); 130 //m_log.Debug(">> HERE, imageURL: " + imageURL);
129 } 131 }
130 if (hash["external_name"] != null) { 132 if (hash["external_name"] != null)
133 {
131 externalName = (string)hash["external_name"]; 134 externalName = (string)hash["external_name"];
132 //m_log.Debug(">> HERE, externalName: " + externalName); 135 //m_log.Debug(">> HERE, externalName: " + externalName);
133 } 136 }
@@ -178,7 +181,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
178 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); 181 //m_log.Debug("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
179 imageData = OpenJPEG.EncodeFromImage(bitmap, true); 182 imageData = OpenJPEG.EncodeFromImage(bitmap, true);
180 } 183 }
181 184
182 AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString()); 185 AssetBase ass = new AssetBase(UUID.Random(), "region " + name, (sbyte)AssetType.Texture, regionID.ToString());
183 186
184 // !!! for now 187 // !!! for now
@@ -199,10 +202,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
199 return mapTile; 202 return mapTile;
200 } 203 }
201 204
202 public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) 205 public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID, UUID agentID, string agentHomeURI, out string message)
203 { 206 {
204 Hashtable hash = new Hashtable(); 207 Hashtable hash = new Hashtable();
205 hash["region_uuid"] = regionID.ToString(); 208 hash["region_uuid"] = regionID.ToString();
209 if (agentID != UUID.Zero)
210 {
211 hash["agent_id"] = agentID.ToString();
212 if (agentHomeURI != null)
213 hash["agent_home_uri"] = agentHomeURI;
214 }
206 215
207 IList paramList = new ArrayList(); 216 IList paramList = new ArrayList();
208 paramList.Add(hash); 217 paramList.Add(hash);
@@ -216,12 +225,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
216 } 225 }
217 catch (Exception e) 226 catch (Exception e)
218 { 227 {
228 message = "Error contacting grid.";
219 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); 229 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message);
220 return null; 230 return null;
221 } 231 }
222 232
223 if (response.IsFault) 233 if (response.IsFault)
224 { 234 {
235 message = "Error contacting grid.";
225 m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString); 236 m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString);
226 return null; 237 return null;
227 } 238 }
@@ -233,6 +244,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
233 { 244 {
234 bool success = false; 245 bool success = false;
235 Boolean.TryParse((string)hash["result"], out success); 246 Boolean.TryParse((string)hash["result"], out success);
247
248 if (hash["message"] != null)
249 message = (string)hash["message"];
250 else if (success)
251 message = null;
252 else
253 message = "The teleport destination could not be found."; // probably the dest grid is old and doesn't send 'message', but the most common problem is that the region is unavailable
254
236 if (success) 255 if (success)
237 { 256 {
238 GridRegion region = new GridRegion(); 257 GridRegion region = new GridRegion();
@@ -252,12 +271,25 @@ namespace OpenSim.Services.Connectors.Hypergrid
252 region.RegionLocY = n; 271 region.RegionLocY = n;
253 //m_log.Debug(">> HERE, y: " + region.RegionLocY); 272 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
254 } 273 }
274 if (hash["size_x"] != null)
275 {
276 Int32.TryParse((string)hash["size_x"], out n);
277 region.RegionSizeX = n;
278 //m_log.Debug(">> HERE, x: " + region.RegionLocX);
279 }
280 if (hash["size_y"] != null)
281 {
282 Int32.TryParse((string)hash["size_y"], out n);
283 region.RegionSizeY = n;
284 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
285 }
255 if (hash["region_name"] != null) 286 if (hash["region_name"] != null)
256 { 287 {
257 region.RegionName = (string)hash["region_name"]; 288 region.RegionName = (string)hash["region_name"];
258 //m_log.Debug(">> HERE, region_name: " + region.RegionName); 289 //m_log.Debug(">> HERE, region_name: " + region.RegionName);
259 } 290 }
260 if (hash["hostname"] != null) { 291 if (hash["hostname"] != null)
292 {
261 region.ExternalHostName = (string)hash["hostname"]; 293 region.ExternalHostName = (string)hash["hostname"];
262 //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); 294 //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName);
263 } 295 }
@@ -275,10 +307,10 @@ namespace OpenSim.Services.Connectors.Hypergrid
275 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); 307 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
276 //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); 308 //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint);
277 } 309 }
278 310
279 if (hash["server_uri"] != null) 311 if (hash["server_uri"] != null)
280 { 312 {
281 region.ServerURI = (string) hash["server_uri"]; 313 region.ServerURI = (string)hash["server_uri"];
282 //m_log.Debug(">> HERE, server_uri: " + region.ServerURI); 314 //m_log.Debug(">> HERE, server_uri: " + region.ServerURI);
283 } 315 }
284 316
@@ -289,61 +321,12 @@ namespace OpenSim.Services.Connectors.Hypergrid
289 } 321 }
290 catch (Exception e) 322 catch (Exception e)
291 { 323 {
324 message = "Error parsing response from grid.";
292 m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace); 325 m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace);
293 return null; 326 return null;
294 } 327 }
295 328
296 return null; 329 return null;
297 } 330 }
298
299 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason)
300 {
301 // m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: CreateAgent start");
302
303 myipaddress = String.Empty;
304 reason = String.Empty;
305
306 if (destination == null)
307 {
308 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Given destination is null");
309 return false;
310 }
311
312 string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
313
314 try
315 {
316 OSDMap args = aCircuit.PackAgentCircuitData();
317
318 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
319 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
320 args["destination_name"] = OSD.FromString(destination.RegionName);
321 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
322 args["teleport_flags"] = OSD.FromString(flags.ToString());
323
324 OSDMap result = WebUtil.PostToService(uri, args, 80000);
325 if (result["Success"].AsBoolean())
326 {
327 OSDMap unpacked = (OSDMap)result["_Result"];
328
329 if (unpacked != null)
330 {
331 reason = unpacked["reason"].AsString();
332 myipaddress = unpacked["your_ip"].AsString();
333 return unpacked["success"].AsBoolean();
334 }
335 }
336
337 reason = result["Message"] != null ? result["Message"].AsString() : "error";
338 return false;
339 }
340 catch (Exception e)
341 {
342 m_log.Warn("[REMOTE SIMULATION CONNECTOR]: CreateAgent failed with exception: " + e.ToString());
343 reason = e.Message;
344 }
345
346 return false;
347 }
348 } 331 }
349} 332}
diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs
index e984a54..622d4e1 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs
@@ -277,7 +277,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
277 { 277 {
278 reply = SynchronousRestFormsRequester.MakeRequest("POST", 278 reply = SynchronousRestFormsRequester.MakeRequest("POST",
279 uri, 279 uri,
280 ServerUtils.BuildQueryString(sendData)); 280 ServerUtils.BuildQueryString(sendData), 15);
281 } 281 }
282 catch (Exception e) 282 catch (Exception e)
283 { 283 {
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs
index 5c50936..b5e6d69 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs
@@ -47,16 +47,22 @@ namespace OpenSim.Services.Connectors
47 47
48 public HeloServicesConnector(string serverURI) 48 public HeloServicesConnector(string serverURI)
49 { 49 {
50 if (!serverURI.EndsWith("=")) 50 try
51 m_ServerURI = serverURI.TrimEnd('/') + "/helo/";
52 else
53 { 51 {
54 // Simian sends malformed urls like this: 52 Uri uri;
55 // http://valley.virtualportland.org/simtest/Grid/?id= 53
56 // 54 if (!serverURI.EndsWith("="))
57 try 55 {
56 // Let's check if this is a valid URI, because it may not be
57 uri = new Uri(serverURI);
58 m_ServerURI = serverURI.TrimEnd('/') + "/helo/";
59 }
60 else
58 { 61 {
59 Uri uri = new Uri(serverURI + "xxx"); 62 // Simian sends malformed urls like this:
63 // http://valley.virtualportland.org/simtest/Grid/?id=
64 //
65 uri = new Uri(serverURI + "xxx");
60 if (uri.Query == string.Empty) 66 if (uri.Query == string.Empty)
61 m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; 67 m_ServerURI = serverURI.TrimEnd('/') + "/helo/";
62 else 68 else
@@ -66,26 +72,34 @@ namespace OpenSim.Services.Connectors
66 m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/"; 72 m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/";
67 } 73 }
68 } 74 }
69 catch (UriFormatException) 75
70 { 76 }
71 m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI); 77 catch (UriFormatException)
72 } 78 {
79 m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI);
73 } 80 }
74 } 81 }
75 82
76
77 public virtual string Helo() 83 public virtual string Helo()
78 { 84 {
79 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); 85 if (String.IsNullOrEmpty(m_ServerURI))
80 // Eventually we need to switch to HEAD 86 {
81 /* req.Method = "HEAD"; */ 87 m_log.WarnFormat("[HELO SERVICE]: Unable to invoke HELO due to empty URL");
88 return String.Empty;
89 }
82 90
83 try 91 try
84 { 92 {
85 WebResponse response = req.GetResponse(); 93 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
86 if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null 94 // Eventually we need to switch to HEAD
87 return string.Empty; 95 /* req.Method = "HEAD"; */
88 return response.Headers.Get("X-Handlers-Provided"); 96
97 using (WebResponse response = req.GetResponse())
98 {
99 if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null
100 return string.Empty;
101 return response.Headers.Get("X-Handlers-Provided");
102 }
89 } 103 }
90 catch (Exception e) 104 catch (Exception e)
91 { 105 {
@@ -95,6 +109,5 @@ namespace OpenSim.Services.Connectors
95 // fail 109 // fail
96 return string.Empty; 110 return string.Empty;
97 } 111 }
98
99 } 112 }
100} 113} \ No newline at end of file
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 2f263ae..8abd046 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -44,13 +44,15 @@ using Nini.Config;
44 44
45namespace OpenSim.Services.Connectors.Hypergrid 45namespace OpenSim.Services.Connectors.Hypergrid
46{ 46{
47 public class UserAgentServiceConnector : IUserAgentService 47 public class UserAgentServiceConnector : SimulationServiceConnector, IUserAgentService
48 { 48 {
49 private static readonly ILog m_log = 49 private static readonly ILog m_log =
50 LogManager.GetLogger( 50 LogManager.GetLogger(
51 MethodBase.GetCurrentMethod().DeclaringType); 51 MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 string m_ServerURL; 53 private string m_ServerURLHost;
54 private string m_ServerURL;
55 private GridRegion m_Gatekeeper;
54 56
55 public UserAgentServiceConnector(string url) : this(url, true) 57 public UserAgentServiceConnector(string url) : this(url, true)
56 { 58 {
@@ -58,7 +60,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
58 60
59 public UserAgentServiceConnector(string url, bool dnsLookup) 61 public UserAgentServiceConnector(string url, bool dnsLookup)
60 { 62 {
61 m_ServerURL = url; 63 m_ServerURL = m_ServerURLHost = url;
62 64
63 if (dnsLookup) 65 if (dnsLookup)
64 { 66 {
@@ -74,10 +76,11 @@ namespace OpenSim.Services.Connectors.Hypergrid
74 } 76 }
75 catch (Exception e) 77 catch (Exception e)
76 { 78 {
77 m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); 79 m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", url, e.Message);
78 } 80 }
79 } 81 }
80 m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL); 82
83 //m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL);
81 } 84 }
82 85
83 public UserAgentServiceConnector(IConfigSource config) 86 public UserAgentServiceConnector(IConfigSource config)
@@ -97,16 +100,23 @@ namespace OpenSim.Services.Connectors.Hypergrid
97 m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); 100 m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService");
98 throw new Exception("UserAgent connector init error"); 101 throw new Exception("UserAgent connector init error");
99 } 102 }
100 m_ServerURL = serviceURI; 103
104 m_ServerURL = m_ServerURLHost = serviceURI;
101 if (!m_ServerURL.EndsWith("/")) 105 if (!m_ServerURL.EndsWith("/"))
102 m_ServerURL += "/"; 106 m_ServerURL += "/";
103 107
104 m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); 108 //m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0}", m_ServerURL);
105 } 109 }
106 110
111 protected override string AgentPath()
112 {
113 return "homeagent/";
114 }
107 115
108 // The Login service calls this interface with a non-null [client] ipaddress 116 // The Login service calls this interface with fromLogin=true
109 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress, out string reason) 117 // Sims call it with fromLogin=false
118 // Either way, this is verified by the handler
119 public bool LoginAgentToGrid(GridRegion source, AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, bool fromLogin, out string reason)
110 { 120 {
111 reason = String.Empty; 121 reason = String.Empty;
112 122
@@ -117,151 +127,34 @@ namespace OpenSim.Services.Connectors.Hypergrid
117 return false; 127 return false;
118 } 128 }
119 129
120 string uri = m_ServerURL + "homeagent/" + aCircuit.AgentID + "/"; 130 GridRegion home = new GridRegion();
121 131 home.ServerURI = m_ServerURL;
122 Console.WriteLine(" >>> LoginAgentToGrid <<< " + uri); 132 home.RegionID = destination.RegionID;
123 133 home.RegionLocX = destination.RegionLocX;
124 HttpWebRequest AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); 134 home.RegionLocY = destination.RegionLocY;
125 AgentCreateRequest.Method = "POST";
126 AgentCreateRequest.ContentType = "application/json";
127 AgentCreateRequest.Timeout = 10000;
128 //AgentCreateRequest.KeepAlive = false;
129 //AgentCreateRequest.Headers.Add("Authorization", authKey);
130
131 // Fill it in
132 OSDMap args = PackCreateAgentArguments(aCircuit, gatekeeper, destination, ipaddress);
133
134 string strBuffer = "";
135 byte[] buffer = new byte[1];
136 try
137 {
138 strBuffer = OSDParser.SerializeJsonString(args);
139 Encoding str = Util.UTF8;
140 buffer = str.GetBytes(strBuffer);
141
142 }
143 catch (Exception e)
144 {
145 m_log.WarnFormat("[USER AGENT CONNECTOR]: Exception thrown on serialization of ChildCreate: {0}", e.Message);
146 // ignore. buffer will be empty, caller should check.
147 }
148
149 Stream os = null;
150 try
151 { // send the Post
152 AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send
153 os = AgentCreateRequest.GetRequestStream();
154 os.Write(buffer, 0, strBuffer.Length); //Send it
155 m_log.InfoFormat("[USER AGENT CONNECTOR]: Posted CreateAgent request to remote sim {0}, region {1}, x={2} y={3}",
156 uri, destination.RegionName, destination.RegionLocX, destination.RegionLocY);
157 }
158 //catch (WebException ex)
159 catch
160 {
161 //m_log.InfoFormat("[USER AGENT CONNECTOR]: Bad send on ChildAgentUpdate {0}", ex.Message);
162 reason = "cannot contact remote region";
163 return false;
164 }
165 finally
166 {
167 if (os != null)
168 os.Close();
169 }
170
171 // Let's wait for the response
172 //m_log.Info("[USER AGENT CONNECTOR]: Waiting for a reply after DoCreateChildAgentCall");
173 135
174 WebResponse webResponse = null; 136 m_Gatekeeper = gatekeeper;
175 StreamReader sr = null;
176 try
177 {
178 webResponse = AgentCreateRequest.GetResponse();
179 if (webResponse == null)
180 {
181 m_log.Info("[USER AGENT CONNECTOR]: Null reply on DoCreateChildAgentCall post");
182 }
183 else
184 {
185 137
186 sr = new StreamReader(webResponse.GetResponseStream()); 138 Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI);
187 string response = sr.ReadToEnd().Trim();
188 m_log.InfoFormat("[USER AGENT CONNECTOR]: DoCreateChildAgentCall reply was {0} ", response);
189
190 if (!String.IsNullOrEmpty(response))
191 {
192 try
193 {
194 // we assume we got an OSDMap back
195 OSDMap r = Util.GetOSDMap(response);
196 bool success = r["success"].AsBoolean();
197 reason = r["reason"].AsString();
198 return success;
199 }
200 catch (NullReferenceException e)
201 {
202 m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", e.Message);
203
204 // check for old style response
205 if (response.ToLower().StartsWith("true"))
206 return true;
207
208 return false;
209 }
210 }
211 }
212 }
213 catch (WebException ex)
214 {
215 m_log.InfoFormat("[USER AGENT CONNECTOR]: exception on reply of DoCreateChildAgentCall {0}", ex.Message);
216 reason = "Destination did not reply";
217 return false;
218 }
219 finally
220 {
221 if (sr != null)
222 sr.Close();
223 }
224
225 return true;
226 139
140 uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome;
141 return CreateAgent(source, home, aCircuit, flags, out reason);
227 } 142 }
228 143
229 144
230 // The simulators call this interface 145 // The simulators call this interface
231 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) 146 public bool LoginAgentToGrid(GridRegion source, AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
232 { 147 {
233 return LoginAgentToGrid(aCircuit, gatekeeper, destination, null, out reason); 148 return LoginAgentToGrid(source, aCircuit, gatekeeper, destination, false, out reason);
234 } 149 }
235 150
236 protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress) 151 protected override void PackData(OSDMap args, GridRegion source, AgentCircuitData aCircuit, GridRegion destination, uint flags)
237 { 152 {
238 OSDMap args = null; 153 base.PackData(args, source, aCircuit, destination, flags);
239 try 154 args["gatekeeper_serveruri"] = OSD.FromString(m_Gatekeeper.ServerURI);
240 { 155 args["gatekeeper_host"] = OSD.FromString(m_Gatekeeper.ExternalHostName);
241 args = aCircuit.PackAgentCircuitData(); 156 args["gatekeeper_port"] = OSD.FromString(m_Gatekeeper.HttpPort.ToString());
242 }
243 catch (Exception e)
244 {
245 m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message);
246 }
247
248 // Add the input arguments
249 args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI);
250 args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName);
251 args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString());
252 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
253 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
254 args["destination_name"] = OSD.FromString(destination.RegionName);
255 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
256 args["destination_serveruri"] = OSD.FromString(destination.ServerURI); 157 args["destination_serveruri"] = OSD.FromString(destination.ServerURI);
257
258 // 10/3/2010
259 // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here.
260 // This need cleaning elsewhere...
261 //if (ipaddress != null)
262 // args["client_ip"] = OSD.FromString(ipaddress.Address.ToString());
263
264 return args;
265 } 158 }
266 159
267 public void SetClientToken(UUID sessionID, string token) 160 public void SetClientToken(UUID sessionID, string token)
@@ -269,96 +162,111 @@ namespace OpenSim.Services.Connectors.Hypergrid
269 // no-op 162 // no-op
270 } 163 }
271 164
272 public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) 165 private Hashtable CallServer(string methodName, Hashtable hash)
273 { 166 {
274 position = Vector3.UnitY; lookAt = Vector3.UnitY;
275
276 Hashtable hash = new Hashtable();
277 hash["userID"] = userID.ToString();
278
279 IList paramList = new ArrayList(); 167 IList paramList = new ArrayList();
280 paramList.Add(hash); 168 paramList.Add(hash);
281 169
282 XmlRpcRequest request = new XmlRpcRequest("get_home_region", paramList); 170 XmlRpcRequest request = new XmlRpcRequest(methodName, paramList);
171
172 // Send and get reply
283 XmlRpcResponse response = null; 173 XmlRpcResponse response = null;
284 try 174 try
285 { 175 {
286 response = request.Send(m_ServerURL, 10000); 176 response = request.Send(m_ServerURL, 10000);
287 } 177 }
288 catch (Exception) 178 catch (Exception e)
289 { 179 {
290 return null; 180 m_log.DebugFormat("[USER AGENT CONNECTOR]: {0} call to {1} failed: {2}", methodName, m_ServerURLHost, e.Message);
181 throw;
291 } 182 }
292 183
293 if (response.IsFault) 184 if (response.IsFault)
294 { 185 {
295 return null; 186 throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned an error: {2}", methodName, m_ServerURLHost, response.FaultString));
296 } 187 }
297 188
298 hash = (Hashtable)response.Value; 189 hash = (Hashtable)response.Value;
299 //foreach (Object o in hash) 190
300 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); 191 if (hash == null)
301 try
302 { 192 {
303 bool success = false; 193 throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned null", methodName, m_ServerURLHost));
304 Boolean.TryParse((string)hash["result"], out success); 194 }
305 if (success)
306 {
307 GridRegion region = new GridRegion();
308 195
309 UUID.TryParse((string)hash["uuid"], out region.RegionID); 196 return hash;
310 //m_log.Debug(">> HERE, uuid: " + region.RegionID); 197 }
311 int n = 0;
312 if (hash["x"] != null)
313 {
314 Int32.TryParse((string)hash["x"], out n);
315 region.RegionLocX = n;
316 //m_log.Debug(">> HERE, x: " + region.RegionLocX);
317 }
318 if (hash["y"] != null)
319 {
320 Int32.TryParse((string)hash["y"], out n);
321 region.RegionLocY = n;
322 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
323 }
324 if (hash["region_name"] != null)
325 {
326 region.RegionName = (string)hash["region_name"];
327 //m_log.Debug(">> HERE, name: " + region.RegionName);
328 }
329 if (hash["hostname"] != null)
330 region.ExternalHostName = (string)hash["hostname"];
331 if (hash["http_port"] != null)
332 {
333 uint p = 0;
334 UInt32.TryParse((string)hash["http_port"], out p);
335 region.HttpPort = p;
336 }
337 if (hash.ContainsKey("server_uri") && hash["server_uri"] != null)
338 region.ServerURI = (string)hash["server_uri"];
339 198
340 if (hash["internal_port"] != null) 199 public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt)
341 { 200 {
342 int p = 0; 201 position = Vector3.UnitY; lookAt = Vector3.UnitY;
343 Int32.TryParse((string)hash["internal_port"], out p);
344 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
345 }
346 if (hash["position"] != null)
347 Vector3.TryParse((string)hash["position"], out position);
348 if (hash["lookAt"] != null)
349 Vector3.TryParse((string)hash["lookAt"], out lookAt);
350 202
351 // Successful return 203 Hashtable hash = new Hashtable();
352 return region; 204 hash["userID"] = userID.ToString();
353 } 205
206 hash = CallServer("get_home_region", hash);
207
208 bool success;
209 if (!Boolean.TryParse((string)hash["result"], out success) || !success)
210 return null;
211
212 GridRegion region = new GridRegion();
354 213
214 UUID.TryParse((string)hash["uuid"], out region.RegionID);
215 //m_log.Debug(">> HERE, uuid: " + region.RegionID);
216 int n = 0;
217 if (hash["x"] != null)
218 {
219 Int32.TryParse((string)hash["x"], out n);
220 region.RegionLocX = n;
221 //m_log.Debug(">> HERE, x: " + region.RegionLocX);
355 } 222 }
356 catch (Exception) 223 if (hash["y"] != null)
357 { 224 {
358 return null; 225 Int32.TryParse((string)hash["y"], out n);
226 region.RegionLocY = n;
227 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
228 }
229 if (hash["size_x"] != null)
230 {
231 Int32.TryParse((string)hash["size_x"], out n);
232 region.RegionSizeX = n;
233 //m_log.Debug(">> HERE, x: " + region.RegionLocX);
359 } 234 }
235 if (hash["size_y"] != null)
236 {
237 Int32.TryParse((string)hash["size_y"], out n);
238 region.RegionSizeY = n;
239 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
240 }
241 if (hash["region_name"] != null)
242 {
243 region.RegionName = (string)hash["region_name"];
244 //m_log.Debug(">> HERE, name: " + region.RegionName);
245 }
246 if (hash["hostname"] != null)
247 region.ExternalHostName = (string)hash["hostname"];
248 if (hash["http_port"] != null)
249 {
250 uint p = 0;
251 UInt32.TryParse((string)hash["http_port"], out p);
252 region.HttpPort = p;
253 }
254 if (hash.ContainsKey("server_uri") && hash["server_uri"] != null)
255 region.ServerURI = (string)hash["server_uri"];
360 256
361 return null; 257 if (hash["internal_port"] != null)
258 {
259 int p = 0;
260 Int32.TryParse((string)hash["internal_port"], out p);
261 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
262 }
263 if (hash["position"] != null)
264 Vector3.TryParse((string)hash["position"], out position);
265 if (hash["lookAt"] != null)
266 Vector3.TryParse((string)hash["lookAt"], out lookAt);
267
268 // Successful return
269 return region;
362 } 270 }
363 271
364 public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) 272 public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName)
@@ -445,14 +353,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
445 } 353 }
446 catch 354 catch
447 { 355 {
448 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for StatusNotification", m_ServerURL); 356 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for StatusNotification", m_ServerURLHost);
449// reason = "Exception: " + e.Message; 357// reason = "Exception: " + e.Message;
450 return friendsOnline; 358 return friendsOnline;
451 } 359 }
452 360
453 if (response.IsFault) 361 if (response.IsFault)
454 { 362 {
455 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for StatusNotification returned an error: {1}", m_ServerURL, response.FaultString); 363 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for StatusNotification returned an error: {1}", m_ServerURLHost, response.FaultString);
456// reason = "XMLRPC Fault"; 364// reason = "XMLRPC Fault";
457 return friendsOnline; 365 return friendsOnline;
458 } 366 }
@@ -464,7 +372,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
464 { 372 {
465 if (hash == null) 373 if (hash == null)
466 { 374 {
467 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); 375 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURLHost);
468// reason = "Internal error 1"; 376// reason = "Internal error 1";
469 return friendsOnline; 377 return friendsOnline;
470 } 378 }
@@ -517,14 +425,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
517 } 425 }
518 catch 426 catch
519 { 427 {
520 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetOnlineFriends", m_ServerURL); 428 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetOnlineFriends", m_ServerURLHost);
521// reason = "Exception: " + e.Message; 429// reason = "Exception: " + e.Message;
522 return online; 430 return online;
523 } 431 }
524 432
525 if (response.IsFault) 433 if (response.IsFault)
526 { 434 {
527 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetOnlineFriends returned an error: {1}", m_ServerURL, response.FaultString); 435 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetOnlineFriends returned an error: {1}", m_ServerURLHost, response.FaultString);
528// reason = "XMLRPC Fault"; 436// reason = "XMLRPC Fault";
529 return online; 437 return online;
530 } 438 }
@@ -536,7 +444,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
536 { 444 {
537 if (hash == null) 445 if (hash == null)
538 { 446 {
539 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); 447 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURLHost);
540// reason = "Internal error 1"; 448// reason = "Internal error 1";
541 return online; 449 return online;
542 } 450 }
@@ -567,51 +475,17 @@ namespace OpenSim.Services.Connectors.Hypergrid
567 Hashtable hash = new Hashtable(); 475 Hashtable hash = new Hashtable();
568 hash["userID"] = userID.ToString(); 476 hash["userID"] = userID.ToString();
569 477
570 IList paramList = new ArrayList(); 478 hash = CallServer("get_user_info", hash);
571 paramList.Add(hash);
572
573 XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList);
574 479
575 Dictionary<string, object> info = new Dictionary<string, object>(); 480 Dictionary<string, object> info = new Dictionary<string, object>();
576 XmlRpcResponse response = null;
577 try
578 {
579 response = request.Send(m_ServerURL, 10000);
580 }
581 catch
582 {
583 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL);
584 return info;
585 }
586 481
587 if (response.IsFault) 482 foreach (object key in hash.Keys)
588 { 483 {
589 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString); 484 if (hash[key] != null)
590 return info;
591 }
592
593 hash = (Hashtable)response.Value;
594 try
595 {
596 if (hash == null)
597 {
598 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
599 return info;
600 }
601
602 // Here is the actual response
603 foreach (object key in hash.Keys)
604 { 485 {
605 if (hash[key] != null) 486 info.Add(key.ToString(), hash[key]);
606 {
607 info.Add(key.ToString(), hash[key]);
608 }
609 } 487 }
610 } 488 }
611 catch
612 {
613 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
614 }
615 489
616 return info; 490 return info;
617 } 491 }
@@ -621,60 +495,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
621 Hashtable hash = new Hashtable(); 495 Hashtable hash = new Hashtable();
622 hash["userID"] = userID.ToString(); 496 hash["userID"] = userID.ToString();
623 497
624 IList paramList = new ArrayList(); 498 hash = CallServer("get_server_urls", hash);
625 paramList.Add(hash); 499
626 500 Dictionary<string, object> serverURLs = new Dictionary<string, object>();
627 XmlRpcRequest request = new XmlRpcRequest("get_server_urls", paramList); 501 foreach (object key in hash.Keys)
628// string reason = string.Empty;
629
630 // Send and get reply
631 Dictionary<string, object> serverURLs = new Dictionary<string,object>();
632 XmlRpcResponse response = null;
633 try
634 {
635 response = request.Send(m_ServerURL, 10000);
636 }
637 catch
638 {
639 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetServerURLs", m_ServerURL);
640// reason = "Exception: " + e.Message;
641 return serverURLs;
642 }
643
644 if (response.IsFault)
645 {
646 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString);
647// reason = "XMLRPC Fault";
648 return serverURLs;
649 }
650
651 hash = (Hashtable)response.Value;
652 //foreach (Object o in hash)
653 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
654 try
655 { 502 {
656 if (hash == null) 503 if (key is string && ((string)key).StartsWith("SRV_") && hash[key] != null)
657 { 504 {
658 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetServerURLs Got null response from {0}! THIS IS BAAAAD", m_ServerURL); 505 string serverType = key.ToString().Substring(4); // remove "SRV_"
659// reason = "Internal error 1"; 506 serverURLs.Add(serverType, hash[key].ToString());
660 return serverURLs;
661 } 507 }
662
663 // Here is the actual response
664 foreach (object key in hash.Keys)
665 {
666 if (key is string && ((string)key).StartsWith("SRV_") && hash[key] != null)
667 {
668 string serverType = key.ToString().Substring(4); // remove "SRV_"
669 serverURLs.Add(serverType, hash[key].ToString());
670 }
671 }
672
673 }
674 catch
675 {
676 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
677// reason = "Exception: " + e.Message;
678 } 508 }
679 509
680 return serverURLs; 510 return serverURLs;
@@ -685,55 +515,13 @@ namespace OpenSim.Services.Connectors.Hypergrid
685 Hashtable hash = new Hashtable(); 515 Hashtable hash = new Hashtable();
686 hash["userID"] = userID.ToString(); 516 hash["userID"] = userID.ToString();
687 517
688 IList paramList = new ArrayList(); 518 hash = CallServer("locate_user", hash);
689 paramList.Add(hash);
690 519
691 XmlRpcRequest request = new XmlRpcRequest("locate_user", paramList);
692// string reason = string.Empty;
693
694 // Send and get reply
695 string url = string.Empty; 520 string url = string.Empty;
696 XmlRpcResponse response = null;
697 try
698 {
699 response = request.Send(m_ServerURL, 10000);
700 }
701 catch
702 {
703 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for LocateUser", m_ServerURL);
704// reason = "Exception: " + e.Message;
705 return url;
706 }
707 521
708 if (response.IsFault) 522 // Here's the actual response
709 { 523 if (hash.ContainsKey("URL"))
710 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for LocateUser returned an error: {1}", m_ServerURL, response.FaultString); 524 url = hash["URL"].ToString();
711// reason = "XMLRPC Fault";
712 return url;
713 }
714
715 hash = (Hashtable)response.Value;
716 //foreach (Object o in hash)
717 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
718 try
719 {
720 if (hash == null)
721 {
722 m_log.ErrorFormat("[USER AGENT CONNECTOR]: LocateUser Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
723// reason = "Internal error 1";
724 return url;
725 }
726
727 // Here's the actual response
728 if (hash.ContainsKey("URL"))
729 url = hash["URL"].ToString();
730
731 }
732 catch
733 {
734 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response.");
735// reason = "Exception: " + e.Message;
736 }
737 525
738 return url; 526 return url;
739 } 527 }
@@ -744,55 +532,13 @@ namespace OpenSim.Services.Connectors.Hypergrid
744 hash["userID"] = userID.ToString(); 532 hash["userID"] = userID.ToString();
745 hash["targetUserID"] = targetUserID.ToString(); 533 hash["targetUserID"] = targetUserID.ToString();
746 534
747 IList paramList = new ArrayList(); 535 hash = CallServer("get_uui", hash);
748 paramList.Add(hash);
749
750 XmlRpcRequest request = new XmlRpcRequest("get_uui", paramList);
751// string reason = string.Empty;
752 536
753 // Send and get reply
754 string uui = string.Empty; 537 string uui = string.Empty;
755 XmlRpcResponse response = null;
756 try
757 {
758 response = request.Send(m_ServerURL, 10000);
759 }
760 catch
761 {
762 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUI", m_ServerURL);
763// reason = "Exception: " + e.Message;
764 return uui;
765 }
766
767 if (response.IsFault)
768 {
769 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUI returned an error: {1}", m_ServerURL, response.FaultString);
770// reason = "XMLRPC Fault";
771 return uui;
772 }
773
774 hash = (Hashtable)response.Value;
775 //foreach (Object o in hash)
776 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
777 try
778 {
779 if (hash == null)
780 {
781 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUI Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
782// reason = "Internal error 1";
783 return uui;
784 }
785 538
786 // Here's the actual response 539 // Here's the actual response
787 if (hash.ContainsKey("UUI")) 540 if (hash.ContainsKey("UUI"))
788 uui = hash["UUI"].ToString(); 541 uui = hash["UUI"].ToString();
789
790 }
791 catch
792 {
793 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetUUI response.");
794// reason = "Exception: " + e.Message;
795 }
796 542
797 return uui; 543 return uui;
798 } 544 }
@@ -803,54 +549,17 @@ namespace OpenSim.Services.Connectors.Hypergrid
803 hash["first"] = first; 549 hash["first"] = first;
804 hash["last"] = last; 550 hash["last"] = last;
805 551
806 IList paramList = new ArrayList(); 552 hash = CallServer("get_uuid", hash);
807 paramList.Add(hash);
808 553
809 XmlRpcRequest request = new XmlRpcRequest("get_uuid", paramList); 554 if (!hash.ContainsKey("UUID"))
810 // string reason = string.Empty;
811
812 // Send and get reply
813 UUID uuid = UUID.Zero;
814 XmlRpcResponse response = null;
815 try
816 {
817 response = request.Send(m_ServerURL, 10000);
818 }
819 catch
820 { 555 {
821 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUID", m_ServerURL); 556 throw new Exception(string.Format("[USER AGENT CONNECTOR]: get_uuid call to {0} didn't return a UUID", m_ServerURLHost));
822 // reason = "Exception: " + e.Message;
823 return uuid;
824 } 557 }
825 558
826 if (response.IsFault) 559 UUID uuid;
827 { 560 if (!UUID.TryParse(hash["UUID"].ToString(), out uuid))
828 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUID returned an error: {1}", m_ServerURL, response.FaultString);
829 // reason = "XMLRPC Fault";
830 return uuid;
831 }
832
833 hash = (Hashtable)response.Value;
834 //foreach (Object o in hash)
835 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
836 try
837 {
838 if (hash == null)
839 {
840 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUDI Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
841 // reason = "Internal error 1";
842 return uuid;
843 }
844
845 // Here's the actual response
846 if (hash.ContainsKey("UUID"))
847 UUID.TryParse(hash["UUID"].ToString(), out uuid);
848
849 }
850 catch
851 { 561 {
852 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on UUID response."); 562 throw new Exception(string.Format("[USER AGENT CONNECTOR]: get_uuid call to {0} returned an invalid UUID: {1}", m_ServerURLHost, hash["UUID"].ToString()));
853 // reason = "Exception: " + e.Message;
854 } 563 }
855 564
856 return uuid; 565 return uuid;
@@ -858,7 +567,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
858 567
859 private bool GetBoolResponse(XmlRpcRequest request, out string reason) 568 private bool GetBoolResponse(XmlRpcRequest request, out string reason)
860 { 569 {
861 //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); 570 //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURLHost);
862 XmlRpcResponse response = null; 571 XmlRpcResponse response = null;
863 try 572 try
864 { 573 {
@@ -866,14 +575,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
866 } 575 }
867 catch (Exception e) 576 catch (Exception e)
868 { 577 {
869 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetBoolResponse", m_ServerURL); 578 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetBoolResponse", m_ServerURLHost);
870 reason = "Exception: " + e.Message; 579 reason = "Exception: " + e.Message;
871 return false; 580 return false;
872 } 581 }
873 582
874 if (response.IsFault) 583 if (response.IsFault)
875 { 584 {
876 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetBoolResponse returned an error: {1}", m_ServerURL, response.FaultString); 585 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetBoolResponse returned an error: {1}", m_ServerURLHost, response.FaultString);
877 reason = "XMLRPC Fault"; 586 reason = "XMLRPC Fault";
878 return false; 587 return false;
879 } 588 }
@@ -885,7 +594,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
885 { 594 {
886 if (hash == null) 595 if (hash == null)
887 { 596 {
888 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURL); 597 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURLHost);
889 reason = "Internal error 1"; 598 reason = "Internal error 1";
890 return false; 599 return false;
891 } 600 }
@@ -896,7 +605,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
896 else 605 else
897 { 606 {
898 reason = "Internal error 2"; 607 reason = "Internal error 2";
899 m_log.WarnFormat("[USER AGENT CONNECTOR]: response from {0} does not have expected key 'result'", m_ServerURL); 608 m_log.WarnFormat("[USER AGENT CONNECTOR]: response from {0} does not have expected key 'result'", m_ServerURLHost);
900 } 609 }
901 610
902 return success; 611 return success;