From 2f409116db570be77fc75df188a4044250dce226 Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 29 May 2010 01:03:59 -0700 Subject: Stop IGridService from throwing a fatal exception when an IPEndPoint cannot be resolved, and add some handlers to deal with this cleanly; a condition was observed on OSGrid where a neighbouring region with an invalid (unresolveable) hostname would prevent a region from starting. This is bad. --- .../Connectors/Hypergrid/GatekeeperServiceConnector.cs | 14 ++++++++++++-- OpenSim/Services/Connectors/Land/LandServiceConnector.cs | 2 ++ .../Connectors/Neighbour/NeighbourServiceConnector.cs | 4 +++- .../Connectors/SimianGrid/SimianGridServiceConnector.cs | 4 +++- .../Connectors/Simulation/SimulationServiceConnector.cs | 8 ++++++-- 5 files changed, 26 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index c426bba..6f159a0 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -87,7 +87,12 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); - string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; + IPEndPoint ext = info.ExternalEndPoint; + string uri = ""; + if (ext != null) + { + uri = "http://" + ext.Address + ":" + info.HttpPort + "/"; + } //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); XmlRpcResponse response = null; try @@ -189,7 +194,12 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - string uri = "http://" + gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"; + IPEndPoint ext = gatekeeper.ExternalEndPoint; + string uri = ""; + if (ext != null) + { + uri = "http://" + ext.Address + ":" + gatekeeper.HttpPort + "/"; + } m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); XmlRpcResponse response = null; try diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs index 06bc11c..0223a77 100644 --- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs @@ -83,6 +83,8 @@ namespace OpenSim.Services.Connectors if (info != null) // just to be sure { XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); + + //Possible nullref from info.externalendpoint will be caught here string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; XmlRpcResponse response = request.Send(uri, 10000); if (response.IsFault) diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs index 0a982f8..daf0439 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServiceConnector.cs @@ -87,7 +87,9 @@ namespace OpenSim.Services.Connectors public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) { - string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; + IPEndPoint ext = region.ExternalEndPoint; + if (ext == null) return false; + string uri = "http://" + ext.Address + ":" + region.HttpPort + "/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 3a61226..57924b7 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -104,6 +104,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public string RegisterRegion(UUID scopeID, GridRegion regionInfo) { + IPEndPoint ext = regionInfo.ExternalEndPoint; + if (ext == null) return "Region registration for " + regionInfo.RegionName + " failed: Could not resolve EndPoint"; Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); @@ -114,7 +116,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) }, { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) }, - { "ExternalAddress", OSD.FromString(regionInfo.ExternalEndPoint.Address.ToString()) }, + { "ExternalAddress", OSD.FromString(ext.Address.ToString()) }, { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) }, { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) }, { "Access", OSD.FromInteger(regionInfo.Access) }, diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 8e0063b..748faef 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -348,9 +348,11 @@ namespace OpenSim.Services.Connectors.Simulation public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) { + IPEndPoint ext = destination.ExternalEndPoint; agent = null; + if (ext == null) return false; // 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 = "http://" + ext.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); @@ -514,8 +516,10 @@ namespace OpenSim.Services.Connectors.Simulation public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) { + IPEndPoint ext = destination.ExternalEndPoint; + if (ext == null) return false; string uri - = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; + = "http://" + ext.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); WebRequest ObjectCreateRequest = WebRequest.Create(uri); -- cgit v1.1