aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
diff options
context:
space:
mode:
authorMelanie2010-10-21 07:33:01 +0100
committerMelanie2010-10-21 07:33:01 +0100
commitfc33d569cd760b0ecf2d487b8d91d4ac3c53d08e (patch)
treeffe3d70e95b159dc4c7b3bf9613bca865d4067d3 /OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
parentCOmmented the wrong line instead, now I commented them all to be on the safe ... (diff)
parentSkip empty strings in ParseString* functions (diff)
downloadopensim-SC-fc33d569cd760b0ecf2d487b8d91d4ac3c53d08e.zip
opensim-SC-fc33d569cd760b0ecf2d487b8d91d4ac3c53d08e.tar.gz
opensim-SC-fc33d569cd760b0ecf2d487b8d91d4ac3c53d08e.tar.bz2
opensim-SC-fc33d569cd760b0ecf2d487b8d91d4ac3c53d08e.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs55
1 files changed, 6 insertions, 49 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index a8ed66d..f855fde 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,26 +104,7 @@ namespace OpenSim.Services.Connectors.Simulation
104 return false; 104 return false;
105 } 105 }
106 106
107 string uri = string.Empty; 107 string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/";
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);
127 108
128 AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); 109 AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri);
129 AgentCreateRequest.Method = "POST"; 110 AgentCreateRequest.Method = "POST";
@@ -277,17 +258,7 @@ namespace OpenSim.Services.Connectors.Simulation
277 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) 258 private bool UpdateAgent(GridRegion destination, IAgentData cAgentData)
278 { 259 {
279 // Eventually, we want to use a caps url instead of the agentID 260 // Eventually, we want to use a caps url instead of the agentID
280 string uri = string.Empty; 261 string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/";
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);
291 262
292 HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); 263 HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri);
293 ChildUpdateRequest.Method = "PUT"; 264 ChildUpdateRequest.Method = "PUT";
@@ -387,8 +358,7 @@ namespace OpenSim.Services.Connectors.Simulation
387 agent = null; 358 agent = null;
388 if (ext == null) return false; 359 if (ext == null) return false;
389 // Eventually, we want to use a caps url instead of the agentID 360 // Eventually, we want to use a caps url instead of the agentID
390 string uri = "http://" + ext.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 361 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
391 //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri);
392 362
393 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); 363 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
394 request.Method = "GET"; 364 request.Method = "GET";
@@ -409,7 +379,6 @@ namespace OpenSim.Services.Connectors.Simulation
409 sr = new StreamReader(webResponse.GetResponseStream()); 379 sr = new StreamReader(webResponse.GetResponseStream());
410 reply = sr.ReadToEnd().Trim(); 380 reply = sr.ReadToEnd().Trim();
411 381
412 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply);
413 382
414 } 383 }
415 catch (WebException ex) 384 catch (WebException ex)
@@ -430,7 +399,6 @@ namespace OpenSim.Services.Connectors.Simulation
430 OSDMap args = Util.GetOSDMap(reply); 399 OSDMap args = Util.GetOSDMap(reply);
431 if (args == null) 400 if (args == null)
432 { 401 {
433 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply");
434 return false; 402 return false;
435 } 403 }
436 404
@@ -439,7 +407,6 @@ namespace OpenSim.Services.Connectors.Simulation
439 return true; 407 return true;
440 } 408 }
441 409
442 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode);
443 return false; 410 return false;
444 } 411 }
445 412
@@ -481,18 +448,8 @@ namespace OpenSim.Services.Connectors.Simulation
481 448
482 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) 449 private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly)
483 { 450 {
484 string uri = string.Empty; 451 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
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 }
494 452
495 //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri);
496 453
497 WebRequest request = WebRequest.Create(uri); 454 WebRequest request = WebRequest.Create(uri);
498 request.Method = "DELETE"; 455 request.Method = "DELETE";
@@ -554,7 +511,7 @@ namespace OpenSim.Services.Connectors.Simulation
554 IPEndPoint ext = destination.ExternalEndPoint; 511 IPEndPoint ext = destination.ExternalEndPoint;
555 if (ext == null) return false; 512 if (ext == null) return false;
556 string uri 513 string uri
557 = "http://" + ext.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; 514 = destination.ServerURI + ObjectPath() + sog.UUID + "/";
558 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); 515 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
559 516
560 WebRequest ObjectCreateRequest = WebRequest.Create(uri); 517 WebRequest ObjectCreateRequest = WebRequest.Create(uri);