diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs')
-rw-r--r-- | OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | 57 |
1 files changed, 7 insertions, 50 deletions
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 1730b95..415c6ea 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.Error("[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,8 @@ 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 | |
281 | try | 262 | string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; |
282 | { | ||
283 | uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; | ||
284 | } | ||
285 | catch (Exception e) | ||
286 | { | ||
287 | m_log.Warn("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); | ||
288 | return false; | ||
289 | } | ||
290 | //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); | ||
291 | 263 | ||
292 | HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); | 264 | HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); |
293 | ChildUpdateRequest.Method = "PUT"; | 265 | ChildUpdateRequest.Method = "PUT"; |
@@ -387,8 +359,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
387 | agent = null; | 359 | agent = null; |
388 | if (ext == null) return false; | 360 | if (ext == null) return false; |
389 | // Eventually, we want to use a caps url instead of the agentID | 361 | // Eventually, we want to use a caps url instead of the agentID |
390 | string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | 362 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; |
391 | //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); | ||
392 | 363 | ||
393 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); | 364 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); |
394 | request.Method = "GET"; | 365 | request.Method = "GET"; |
@@ -409,7 +380,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
409 | sr = new StreamReader(webResponse.GetResponseStream()); | 380 | sr = new StreamReader(webResponse.GetResponseStream()); |
410 | reply = sr.ReadToEnd().Trim(); | 381 | reply = sr.ReadToEnd().Trim(); |
411 | 382 | ||
412 | //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply); | ||
413 | 383 | ||
414 | } | 384 | } |
415 | catch (WebException ex) | 385 | catch (WebException ex) |
@@ -430,7 +400,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
430 | OSDMap args = Util.GetOSDMap(reply); | 400 | OSDMap args = Util.GetOSDMap(reply); |
431 | if (args == null) | 401 | if (args == null) |
432 | { | 402 | { |
433 | //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply"); | ||
434 | return false; | 403 | return false; |
435 | } | 404 | } |
436 | 405 | ||
@@ -439,7 +408,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
439 | return true; | 408 | return true; |
440 | } | 409 | } |
441 | 410 | ||
442 | //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); | ||
443 | return false; | 411 | return false; |
444 | } | 412 | } |
445 | 413 | ||
@@ -481,18 +449,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
481 | 449 | ||
482 | private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) | 450 | private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) |
483 | { | 451 | { |
484 | string uri = string.Empty; | 452 | 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.Warn("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); | ||
492 | return false; | ||
493 | } | ||
494 | |||
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://" + destination.ExternalEndPoint.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); |