aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs55
1 files changed, 49 insertions, 6 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index c4284eb..a5f748f 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";
@@ -356,7 +385,8 @@ namespace OpenSim.Services.Connectors.Simulation
356 { 385 {
357 agent = null; 386 agent = null;
358 // Eventually, we want to use a caps url instead of the agentID 387 // Eventually, we want to use a caps url instead of the agentID
359 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 388 string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
389 //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri);
360 390
361 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); 391 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
362 request.Method = "GET"; 392 request.Method = "GET";
@@ -377,6 +407,7 @@ namespace OpenSim.Services.Connectors.Simulation
377 sr = new StreamReader(webResponse.GetResponseStream()); 407 sr = new StreamReader(webResponse.GetResponseStream());
378 reply = sr.ReadToEnd().Trim(); 408 reply = sr.ReadToEnd().Trim();
379 409
410 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply);
380 411
381 } 412 }
382 catch (WebException ex) 413 catch (WebException ex)
@@ -397,6 +428,7 @@ namespace OpenSim.Services.Connectors.Simulation
397 OSDMap args = Util.GetOSDMap(reply); 428 OSDMap args = Util.GetOSDMap(reply);
398 if (args == null) 429 if (args == null)
399 { 430 {
431 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply");
400 return false; 432 return false;
401 } 433 }
402 434
@@ -405,6 +437,7 @@ namespace OpenSim.Services.Connectors.Simulation
405 return true; 437 return true;
406 } 438 }
407 439
440 //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode);
408 return false; 441 return false;
409 } 442 }
410 443
@@ -446,8 +479,18 @@ namespace OpenSim.Services.Connectors.Simulation
446 479
447 public bool CloseAgent(GridRegion destination, UUID id) 480 public bool CloseAgent(GridRegion destination, UUID id)
448 { 481 {
449 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 482 string uri = string.Empty;
483 try
484 {
485 uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/";
486 }
487 catch (Exception e)
488 {
489 m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message);
490 return false;
491 }
450 492
493 //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri);
451 494
452 WebRequest request = WebRequest.Create(uri); 495 WebRequest request = WebRequest.Create(uri);
453 request.Method = "DELETE"; 496 request.Method = "DELETE";
@@ -495,7 +538,7 @@ namespace OpenSim.Services.Connectors.Simulation
495 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) 538 public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall)
496 { 539 {
497 string uri 540 string uri
498 = destination.ServerURI + ObjectPath() + sog.UUID + "/"; 541 = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/";
499 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); 542 //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri);
500 543
501 WebRequest ObjectCreateRequest = WebRequest.Create(uri); 544 WebRequest ObjectCreateRequest = WebRequest.Create(uri);