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 --- .../Hypergrid/GatekeeperServiceConnector.cs | 31 +++++++++------ .../Connectors/Land/LandServiceConnector.cs | 3 +- .../Neighbour/NeighbourServiceConnector.cs | 2 +- .../SimianGrid/SimianGridServiceConnector.cs | 4 +- .../Simulation/SimulationServiceConnector.cs | 45 +++------------------- 5 files changed, 27 insertions(+), 58 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 479a80e..89a8f7a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -108,8 +108,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - //foreach (Object o in hash) - // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + foreach (Object o in hash) + m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -117,16 +117,20 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - //m_log.Debug(">> HERE, uuid: " + uuid); + m_log.Debug(">> HERE, uuid: " + regionID); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - //m_log.Debug(">> HERE, realHandle: " + realHandle); + m_log.Debug(">> HERE, realHandle: " + realHandle); } - if (hash["region_image"] != null) + if (hash["region_image"] != null) { imageURL = (string)hash["region_image"]; - if (hash["external_name"] != null) + m_log.Debug(">> HERE, imageURL: " + imageURL); + } + if (hash["external_name"] != null) { externalName = (string)hash["external_name"]; + m_log.Debug(">> HERE, externalName: " + externalName); + } } } @@ -208,8 +212,8 @@ namespace OpenSim.Services.Connectors.Hypergrid } hash = (Hashtable)response.Value; - //foreach (Object o in hash) - // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + foreach (Object o in hash) + m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); try { bool success = false; @@ -219,38 +223,41 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - //m_log.Debug(">> HERE, uuid: " + region.RegionID); + m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - //m_log.Debug(">> HERE, x: " + region.RegionLocX); + m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - //m_log.Debug(">> HERE, y: " + region.RegionLocY); + m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - //m_log.Debug(">> HERE, name: " + region.RegionName); + m_log.Debug(">> HERE, region_name: " + region.RegionName); } if (hash["hostname"] != null) region.ExternalHostName = (string)hash["hostname"]; + m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; + m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); + m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); } // Successful return diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index 8143b5a..4b25ac8 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs @@ -84,8 +84,7 @@ namespace OpenSim.Services.Connectors if (info != null) // just to be sure { XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); - string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; - XmlRpcResponse response = request.Send(uri, 10000); + XmlRpcResponse response = request.Send(info.ServerURI, 10000); if (response.IsFault) { m_log.ErrorFormat("[LAND CONNECTOR]: remote call returned an error: {0}", response.FaultString); diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 0a982f8..9c57a40 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs @@ -87,7 +87,7 @@ namespace OpenSim.Services.Connectors public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) { - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; + string uri = region.ServerURI + "/region/" + thisRegion.RegionID + "/"; //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); WebRequest HelloNeighbourRequest = WebRequest.Create(uri); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 4409d5c..0a9f230 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -145,8 +145,6 @@ namespace OpenSim.Services.Connectors.SimianGrid Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); - string httpAddress = "http://" + regionInfo.ExternalHostName + ":" + regionInfo.HttpPort + "/"; - OSDMap extraData = new OSDMap { { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, @@ -168,7 +166,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { "Name", regionInfo.RegionName }, { "MinPosition", minPosition.ToString() }, { "MaxPosition", maxPosition.ToString() }, - { "Address", httpAddress }, + { "Address", regionInfo.ServerURI }, { "Enabled", "1" }, { "ExtraData", OSDParser.SerializeJsonString(extraData) } }; 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