aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
authorMelanie2010-10-23 00:21:42 +0100
committerMelanie2010-10-23 00:21:42 +0100
commit7f74dc1b14d3ef31a9f20bb3a76ef8d587779f7e (patch)
tree73f156f1f7dc7d199a946d351828c7e725ebfbda /OpenSim/Services/Connectors
parentChange some exception to use ToString(). e.Message is not sufficient to fix (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-7f74dc1b14d3ef31a9f20bb3a76ef8d587779f7e.zip
opensim-SC_OLD-7f74dc1b14d3ef31a9f20bb3a76ef8d587779f7e.tar.gz
opensim-SC_OLD-7f74dc1b14d3ef31a9f20bb3a76ef8d587779f7e.tar.bz2
opensim-SC_OLD-7f74dc1b14d3ef31a9f20bb3a76ef8d587779f7e.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Services/Connectors')
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/Land/LandServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs4
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs55
5 files changed, 70 insertions, 29 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 4231be1..479a80e 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -63,12 +63,12 @@ namespace OpenSim.Services.Connectors.Hypergrid
63 63
64 protected override string AgentPath() 64 protected override string AgentPath()
65 { 65 {
66 return "foreignagent/"; 66 return "/foreignagent/";
67 } 67 }
68 68
69 protected override string ObjectPath() 69 protected override string ObjectPath()
70 { 70 {
71 return "foreignobject/"; 71 return "/foreignobject/";
72 } 72 }
73 73
74 public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) 74 public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason)
@@ -86,11 +86,12 @@ namespace OpenSim.Services.Connectors.Hypergrid
86 paramList.Add(hash); 86 paramList.Add(hash);
87 87
88 XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); 88 XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
89 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + info.ServerURI); 89 string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/");
90 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
90 XmlRpcResponse response = null; 91 XmlRpcResponse response = null;
91 try 92 try
92 { 93 {
93 response = request.Send(info.ServerURI, 10000); 94 response = request.Send(uri, 10000);
94 } 95 }
95 catch (Exception e) 96 catch (Exception e)
96 { 97 {
@@ -107,8 +108,8 @@ namespace OpenSim.Services.Connectors.Hypergrid
107 } 108 }
108 109
109 hash = (Hashtable)response.Value; 110 hash = (Hashtable)response.Value;
110 foreach (Object o in hash) 111 //foreach (Object o in hash)
111 m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); 112 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
112 try 113 try
113 { 114 {
114 bool success = false; 115 bool success = false;
@@ -116,20 +117,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
116 if (success) 117 if (success)
117 { 118 {
118 UUID.TryParse((string)hash["uuid"], out regionID); 119 UUID.TryParse((string)hash["uuid"], out regionID);
119 //m_log.Debug(">> HERE, uuid: " + regionID); 120 //m_log.Debug(">> HERE, uuid: " + uuid);
120 if ((string)hash["handle"] != null) 121 if ((string)hash["handle"] != null)
121 { 122 {
122 realHandle = Convert.ToUInt64((string)hash["handle"]); 123 realHandle = Convert.ToUInt64((string)hash["handle"]);
123 //m_log.Debug(">> HERE, realHandle: " + realHandle); 124 //m_log.Debug(">> HERE, realHandle: " + realHandle);
124 } 125 }
125 if (hash["region_image"] != null) { 126 if (hash["region_image"] != null)
126 imageURL = (string)hash["region_image"]; 127 imageURL = (string)hash["region_image"];
127 //m_log.Debug(">> HERE, imageURL: " + imageURL); 128 if (hash["external_name"] != null)
128 }
129 if (hash["external_name"] != null) {
130 externalName = (string)hash["external_name"]; 129 externalName = (string)hash["external_name"];
131 //m_log.Debug(">> HERE, externalName: " + externalName);
132 }
133 } 130 }
134 131
135 } 132 }
@@ -191,15 +188,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
191 paramList.Add(hash); 188 paramList.Add(hash);
192 189
193 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); 190 XmlRpcRequest request = new XmlRpcRequest("get_region", paramList);
194 //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); 191 string uri = "http://" + ((gatekeeper.ServerURI != null && gatekeeper.ServerURI != string.Empty && !gatekeeper.ServerURI.StartsWith("http:")) ? gatekeeper.ServerURI : gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/");
192 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri);
195 XmlRpcResponse response = null; 193 XmlRpcResponse response = null;
196 try 194 try
197 { 195 {
198 response = request.Send(gatekeeper.ServerURI, 10000); 196 response = request.Send(uri, 10000);
199 } 197 }
200 catch (Exception e) 198 catch (Exception e)
201 { 199 {
202 //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); 200 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message);
203 return null; 201 return null;
204 } 202 }
205 203
@@ -238,24 +236,21 @@ namespace OpenSim.Services.Connectors.Hypergrid
238 if (hash["region_name"] != null) 236 if (hash["region_name"] != null)
239 { 237 {
240 region.RegionName = (string)hash["region_name"]; 238 region.RegionName = (string)hash["region_name"];
241 //m_log.Debug(">> HERE, region_name: " + region.RegionName); 239 //m_log.Debug(">> HERE, name: " + region.RegionName);
242 } 240 }
243 if (hash["hostname"] != null) 241 if (hash["hostname"] != null)
244 region.ExternalHostName = (string)hash["hostname"]; 242 region.ExternalHostName = (string)hash["hostname"];
245 //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName);
246 if (hash["http_port"] != null) 243 if (hash["http_port"] != null)
247 { 244 {
248 uint p = 0; 245 uint p = 0;
249 UInt32.TryParse((string)hash["http_port"], out p); 246 UInt32.TryParse((string)hash["http_port"], out p);
250 region.HttpPort = p; 247 region.HttpPort = p;
251 //m_log.Debug(">> HERE, http_port: " + region.HttpPort);
252 } 248 }
253 if (hash["internal_port"] != null) 249 if (hash["internal_port"] != null)
254 { 250 {
255 int p = 0; 251 int p = 0;
256 Int32.TryParse((string)hash["internal_port"], out p); 252 Int32.TryParse((string)hash["internal_port"], out p);
257 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); 253 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
258 //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint);
259 } 254 }
260 255
261 // Successful return 256 // Successful return
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
index 10499e2..539b2cc 100644
--- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
@@ -84,7 +84,8 @@ namespace OpenSim.Services.Connectors
84 if (info != null) // just to be sure 84 if (info != null) // just to be sure
85 { 85 {
86 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); 86 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
87 XmlRpcResponse response = request.Send(info.ServerURI, 10000); 87 string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
88 XmlRpcResponse response = request.Send(uri, 10000);
88 if (response.IsFault) 89 if (response.IsFault)
89 { 90 {
90 m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); 91 m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString);
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
index 9c57a40..0a982f8 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors
87 87
88 public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) 88 public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion)
89 { 89 {
90 string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; 90 string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/";
91 //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); 91 //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri);
92 92
93 WebRequest HelloNeighbourRequest = WebRequest.Create(uri); 93 WebRequest HelloNeighbourRequest = WebRequest.Create(uri);
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index f86eba3..4fc2a6d 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -147,6 +147,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
147 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); 147 Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0);
148 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); 148 Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0);
149 149
150 string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/";
151
150 OSDMap extraData = new OSDMap 152 OSDMap extraData = new OSDMap
151 { 153 {
152 { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, 154 { "ServerURI", OSD.FromString(regionInfo.ServerURI) },
@@ -168,7 +170,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
168 { "Name", regionInfo.RegionName }, 170 { "Name", regionInfo.RegionName },
169 { "MinPosition", minPosition.ToString() }, 171 { "MinPosition", minPosition.ToString() },
170 { "MaxPosition", maxPosition.ToString() }, 172 { "MaxPosition", maxPosition.ToString() },
171 { "Address", regionInfo.ServerURI }, 173 { "Address", httpAddress },
172 { "Enabled", "1" }, 174 { "Enabled", "1" },
173 { "ExtraData", OSDParser.SerializeJsonString(extraData) } 175 { "ExtraData", OSDParser.SerializeJsonString(extraData) }
174 }; 176 };
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index f855fde..385ba31 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation
72 72
73 protected virtual string AgentPath() 73 protected virtual string AgentPath()
74 { 74 {
75 return "agent/"; 75 return "/agent/";
76 } 76 }
77 77
78 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) 78 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
@@ -104,7 +104,26 @@ namespace OpenSim.Services.Connectors.Simulation
104 return false; 104 return false;
105 } 105 }
106 106
107 string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; 107 string uri = string.Empty;
108
109 // HACK -- Simian grid make it work!!!
110 if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:"))
111 uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
112 else
113 {
114 try
115 {
116 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/";
117 }
118 catch (Exception e)
119 {
120 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message);
121 reason = e.Message;
122 return false;
123 }
124 }
125
126 //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri);
108 127
109 AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); 128 AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
110 AgentCreateRequest.Method = "POST"; 129 AgentCreateRequest.Method = "POST";
@@ -258,7 +277,17 @@ namespace OpenSim.Services.Connectors.Simulation
258 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) 277 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData)
259 { 278 {
260 // Eventually, we want to use a caps url instead of the agentID 279 // Eventually, we want to use a caps url instead of the agentID
261 string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; 280 string uri = string.Empty;
281 try
282 {
283 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/";
284 }
285 catch (Exception e)
286 {
287 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message);
288 return false;
289 }
290 //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri);
262 291
263 HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); 292 HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri);
264 ChildUpdateRequest.Method = "PUT"; 293 ChildUpdateRequest.Method = "PUT";
@@ -358,7 +387,8 @@ namespace OpenSim.Services.Connectors.Simulation
358 agent = null; 387 agent = null;
359 if (ext == null) return false; 388 if (ext == null) return false;
360 // Eventually, we want to use a caps url instead of the agentID 389 // Eventually, we want to use a caps url instead of the agentID
361 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 390 string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
391 //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri);
362 392
363 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); 393 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
364 request.Method = "GET"; 394 request.Method = "GET";
@@ -379,6 +409,7 @@ namespace OpenSim.Services.Connectors.Simulation
379 sr = new StreamReader(webResponse.GetResponseStream()); 409 sr = new StreamReader(webResponse.GetResponseStream());
380 reply = sr.ReadToEnd().Trim(); 410 reply = sr.ReadToEnd().Trim();
381 411
412 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply);
382 413
383 } 414 }
384 catch (WebException ex) 415 catch (WebException ex)
@@ -399,6 +430,7 @@ namespace OpenSim.Services.Connectors.Simulation
399 OSDMap args = Util.GetOSDMap(reply); 430 OSDMap args = Util.GetOSDMap(reply);
400 if (args == null) 431 if (args == null)
401 { 432 {
433 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply");
402 return false; 434 return false;
403 } 435 }
404 436
@@ -407,6 +439,7 @@ namespace OpenSim.Services.Connectors.Simulation
407 return true; 439 return true;
408 } 440 }
409 441
442 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode);
410 return false; 443 return false;
411 } 444 }
412 445
@@ -448,8 +481,18 @@ namespace OpenSim.Services.Connectors.Simulation
448 481
449 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) 482 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
450 { 483 {
451 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 484 string uri = string.Empty;
485 try
486 {
487 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
488 }
489 catch (Exception e)
490 {
491 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message);
492 return false;
493 }
452 494
495 //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri);
453 496
454 WebRequest request = WebRequest.Create(uri); 497 WebRequest request = WebRequest.Create(uri);
455 request.Method = "DELETE"; 498 request.Method = "DELETE";
@@ -511,7 +554,7 @@ namespace OpenSim.Services.Connectors.Simulation
511 IPEndPoint ext = destination.ExternalEndPoint; 554 IPEndPoint ext = destination.ExternalEndPoint;
512 if (ext == null) return false; 555 if (ext == null) return false;
513 string uri 556 string uri
514 = destination.ServerURI + ObjectPath() + sog.UUID + "/"; 557 = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/";
515 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); 558 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
516 559
517 WebRequest ObjectCreateRequest = WebRequest.Create(uri); 560 WebRequest ObjectCreateRequest = WebRequest.Create(uri);