From 32ccc7a9d912543c0a5d3f8db839734194f3d8dd Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sat, 2 Oct 2010 19:17:02 -0400 Subject: * refactor refactor refactor ServerURI 4 lyfe --- .../Simulation/SimulationServiceConnector.cs | 45 +++------------------- 1 file changed, 5 insertions(+), 40 deletions(-) (limited to 'OpenSim/Services/Connectors/Simulation') diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index a5f748f..07839d3 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -104,24 +104,7 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - string uri = string.Empty; - - // HACK -- Simian grid make it work!!! - if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) - uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; - else - { - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); - reason = e.Message; - return false; - } - } + string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); @@ -277,16 +260,7 @@ namespace OpenSim.Services.Connectors.Simulation private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) { // Eventually, we want to use a caps url instead of the agentID - string uri = string.Empty; - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); - return false; - } + string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); @@ -385,7 +359,7 @@ namespace OpenSim.Services.Connectors.Simulation { agent = null; // Eventually, we want to use a caps url instead of the agentID - string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); @@ -479,16 +453,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CloseAgent(GridRegion destination, UUID id) { - string uri = string.Empty; - try - { - uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - } - catch (Exception e) - { - m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); - return false; - } + string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); @@ -538,7 +503,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) { string uri - = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; + = destination.ServerURI + ObjectPath() + sog.UUID + "/"; //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); WebRequest ObjectCreateRequest = WebRequest.Create(uri); -- cgit v1.1 From 69acf9c79b9e83047c2a0494a6f96c7d33839d3b Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Sun, 3 Oct 2010 18:03:53 -0400 Subject: * additional serveruri cleanup --- .../Connectors/Simulation/SimulationServiceConnector.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'OpenSim/Services/Connectors/Simulation') diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 07839d3..c4284eb 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -72,7 +72,7 @@ namespace OpenSim.Services.Connectors.Simulation protected virtual string AgentPath() { - return "/agent/"; + return "agent/"; } public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) @@ -106,8 +106,6 @@ namespace OpenSim.Services.Connectors.Simulation string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; - //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); - AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); AgentCreateRequest.Method = "POST"; AgentCreateRequest.ContentType = "application/json"; @@ -261,7 +259,6 @@ namespace OpenSim.Services.Connectors.Simulation { // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; - //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); ChildUpdateRequest.Method = "PUT"; @@ -360,7 +357,6 @@ namespace OpenSim.Services.Connectors.Simulation agent = null; // Eventually, we want to use a caps url instead of the agentID string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "GET"; @@ -381,7 +377,6 @@ namespace OpenSim.Services.Connectors.Simulation sr = new StreamReader(webResponse.GetResponseStream()); reply = sr.ReadToEnd().Trim(); - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply); } catch (WebException ex) @@ -402,7 +397,6 @@ namespace OpenSim.Services.Connectors.Simulation OSDMap args = Util.GetOSDMap(reply); if (args == null) { - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply"); return false; } @@ -411,7 +405,6 @@ namespace OpenSim.Services.Connectors.Simulation return true; } - //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); return false; } @@ -455,7 +448,6 @@ namespace OpenSim.Services.Connectors.Simulation { string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); WebRequest request = WebRequest.Create(uri); request.Method = "DELETE"; -- cgit v1.1 From fe8d3d5a2bc0ddbc051d8a7ad2412da5f3546075 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 22 Oct 2010 23:52:07 +0100 Subject: Revert "Merge remote branch 'otakup0pe/mantis5110'" This reverts commit 21187f459ea2ae590dda4249fa15ebf116d04fe0, reversing changes made to 8f34e46d7449be1c29419a232a8f7f1e5918f03c. --- .../Simulation/SimulationServiceConnector.cs | 55 +++++++++++++++++++--- 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/Connectors/Simulation') 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 protected virtual string AgentPath() { - return "agent/"; + return "/agent/"; } public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) @@ -104,7 +104,26 @@ namespace OpenSim.Services.Connectors.Simulation return false; } - string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; + string uri = string.Empty; + + // HACK -- Simian grid make it work!!! + if (destination.ServerURI != null && destination.ServerURI != string.Empty && !destination.ServerURI.StartsWith("http:")) + uri = "http://" + destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; + else + { + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + aCircuit.AgentID + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent create. Reason: " + e.Message); + reason = e.Message; + return false; + } + } + + //Console.WriteLine(" >>> DoCreateChildAgentCall <<< " + uri); AgentCreateRequest = (HttpWebRequest)WebRequest.Create(uri); AgentCreateRequest.Method = "POST"; @@ -258,7 +277,17 @@ namespace OpenSim.Services.Connectors.Simulation private bool UpdateAgent(GridRegion destination, IAgentData cAgentData) { // Eventually, we want to use a caps url instead of the agentID - string uri = destination.ServerURI + AgentPath() + cAgentData.AgentID + "/"; + string uri = string.Empty; + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + cAgentData.AgentID + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent update. Reason: " + e.Message); + return false; + } + //Console.WriteLine(" >>> DoAgentUpdateCall <<< " + uri); HttpWebRequest ChildUpdateRequest = (HttpWebRequest)WebRequest.Create(uri); ChildUpdateRequest.Method = "PUT"; @@ -356,7 +385,8 @@ namespace OpenSim.Services.Connectors.Simulation { agent = null; // Eventually, we want to use a caps url instead of the agentID - string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "GET"; @@ -377,6 +407,7 @@ namespace OpenSim.Services.Connectors.Simulation sr = new StreamReader(webResponse.GetResponseStream()); reply = sr.ReadToEnd().Trim(); + //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: ChilAgentUpdate reply was " + reply); } catch (WebException ex) @@ -397,6 +428,7 @@ namespace OpenSim.Services.Connectors.Simulation OSDMap args = Util.GetOSDMap(reply); if (args == null) { + //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: Error getting OSDMap from reply"); return false; } @@ -405,6 +437,7 @@ namespace OpenSim.Services.Connectors.Simulation return true; } + //Console.WriteLine("[REMOTE SIMULATION CONNECTOR]: DoRetrieveRootAgentCall returned status " + webResponse.StatusCode); return false; } @@ -446,8 +479,18 @@ namespace OpenSim.Services.Connectors.Simulation public bool CloseAgent(GridRegion destination, UUID id) { - string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + string uri = string.Empty; + try + { + uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; + } + catch (Exception e) + { + m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Unable to resolve external endpoint on agent close. Reason: " + e.Message); + return false; + } + //Console.WriteLine(" >>> DoCloseAgentCall <<< " + uri); WebRequest request = WebRequest.Create(uri); request.Method = "DELETE"; @@ -495,7 +538,7 @@ namespace OpenSim.Services.Connectors.Simulation public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) { string uri - = destination.ServerURI + ObjectPath() + sog.UUID + "/"; + = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); WebRequest ObjectCreateRequest = WebRequest.Create(uri); -- cgit v1.1