diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Services/Connectors/Simulation')
-rw-r--r-- | OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | 55 |
1 files changed, 49 insertions, 6 deletions
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); |