diff options
author | Tom Grimshaw | 2010-05-29 01:03:59 -0700 |
---|---|---|
committer | Tom Grimshaw | 2010-05-29 01:03:59 -0700 |
commit | 2f409116db570be77fc75df188a4044250dce226 (patch) | |
tree | 424980e50591e1d4b7d89fe88960e457b19c457d | |
parent | Merge branch 'careminster-presence-refactor' of www.3dhosting.de:/var/git/car... (diff) | |
download | opensim-SC-2f409116db570be77fc75df188a4044250dce226.zip opensim-SC-2f409116db570be77fc75df188a4044250dce226.tar.gz opensim-SC-2f409116db570be77fc75df188a4044250dce226.tar.bz2 opensim-SC-2f409116db570be77fc75df188a4044250dce226.tar.xz |
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.
Diffstat (limited to '')
8 files changed, 53 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ef37f63..dc1025d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
261 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 261 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
262 | // it's actually doing a lot of work. | 262 | // it's actually doing a lot of work. |
263 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 263 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
264 | if (endPoint.Address != null) | 264 | if (endPoint != null && endPoint.Address != null) |
265 | { | 265 | { |
266 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 266 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
267 | // both regions | 267 | // both regions |
@@ -825,15 +825,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
825 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 825 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
826 | 826 | ||
827 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 827 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
828 | if (eq != null) | 828 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; |
829 | { | 829 | if (neighbourExternal != null) |
830 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
831 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
832 | } | ||
833 | else | ||
834 | { | 830 | { |
835 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 831 | if (eq != null) |
836 | capsPath); | 832 | { |
833 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
834 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
835 | } | ||
836 | else | ||
837 | { | ||
838 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
839 | capsPath); | ||
840 | } | ||
837 | } | 841 | } |
838 | 842 | ||
839 | if (!WaitForCallback(agent.UUID)) | 843 | if (!WaitForCallback(agent.UUID)) |
@@ -906,10 +910,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
906 | agent.child = true; | 910 | agent.child = true; |
907 | agent.Appearance = sp.Appearance; | 911 | agent.Appearance = sp.Appearance; |
908 | 912 | ||
909 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 913 | IPEndPoint external = region.ExternalEndPoint; |
910 | d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, | 914 | if (external != null) |
915 | { | ||
916 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
917 | d.BeginInvoke(sp, agent, region, external, true, | ||
911 | InformClientOfNeighbourCompleted, | 918 | InformClientOfNeighbourCompleted, |
912 | d); | 919 | d); |
920 | } | ||
913 | } | 921 | } |
914 | #endregion | 922 | #endregion |
915 | 923 | ||
@@ -1038,6 +1046,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1038 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1046 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1039 | try | 1047 | try |
1040 | { | 1048 | { |
1049 | //neighbour.ExternalEndPoint may return null, which will be caught | ||
1041 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1050 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
1042 | InformClientOfNeighbourCompleted, | 1051 | InformClientOfNeighbourCompleted, |
1043 | d); | 1052 | d); |
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 | |||
87 | paramList.Add(hash); | 87 | paramList.Add(hash); |
88 | 88 | ||
89 | XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); | 89 | XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); |
90 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; | 90 | IPEndPoint ext = info.ExternalEndPoint; |
91 | string uri = ""; | ||
92 | if (ext != null) | ||
93 | { | ||
94 | uri = "http://" + ext.Address + ":" + info.HttpPort + "/"; | ||
95 | } | ||
91 | //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); | 96 | //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); |
92 | XmlRpcResponse response = null; | 97 | XmlRpcResponse response = null; |
93 | try | 98 | try |
@@ -189,7 +194,12 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
189 | paramList.Add(hash); | 194 | paramList.Add(hash); |
190 | 195 | ||
191 | XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); | 196 | XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); |
192 | string uri = "http://" + gatekeeper.ExternalEndPoint.Address + ":" + gatekeeper.HttpPort + "/"; | 197 | IPEndPoint ext = gatekeeper.ExternalEndPoint; |
198 | string uri = ""; | ||
199 | if (ext != null) | ||
200 | { | ||
201 | uri = "http://" + ext.Address + ":" + gatekeeper.HttpPort + "/"; | ||
202 | } | ||
193 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); | 203 | m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + uri); |
194 | XmlRpcResponse response = null; | 204 | XmlRpcResponse response = null; |
195 | try | 205 | 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 | |||
83 | if (info != null) // just to be sure | 83 | if (info != null) // just to be sure |
84 | { | 84 | { |
85 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); | 85 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); |
86 | |||
87 | //Possible nullref from info.externalendpoint will be caught here | ||
86 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; | 88 | string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; |
87 | XmlRpcResponse response = request.Send(uri, 10000); | 89 | XmlRpcResponse response = request.Send(uri, 10000); |
88 | if (response.IsFault) | 90 | 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 | |||
87 | 87 | ||
88 | public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) | 88 | public bool DoHelloNeighbourCall(GridRegion region, RegionInfo thisRegion) |
89 | { | 89 | { |
90 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; | 90 | IPEndPoint ext = region.ExternalEndPoint; |
91 | if (ext == null) return false; | ||
92 | string uri = "http://" + ext.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; | ||
91 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); | 93 | //m_log.Debug(" >>> DoHelloNeighbourCall <<< " + uri); |
92 | 94 | ||
93 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); | 95 | 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 | |||
104 | 104 | ||
105 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) | 105 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) |
106 | { | 106 | { |
107 | IPEndPoint ext = regionInfo.ExternalEndPoint; | ||
108 | if (ext == null) return "Region registration for " + regionInfo.RegionName + " failed: Could not resolve EndPoint"; | ||
107 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); | 109 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); |
108 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); | 110 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, 4096.0); |
109 | 111 | ||
@@ -114,7 +116,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
114 | { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, | 116 | { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, |
115 | { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) }, | 117 | { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) }, |
116 | { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) }, | 118 | { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) }, |
117 | { "ExternalAddress", OSD.FromString(regionInfo.ExternalEndPoint.Address.ToString()) }, | 119 | { "ExternalAddress", OSD.FromString(ext.Address.ToString()) }, |
118 | { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) }, | 120 | { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) }, |
119 | { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) }, | 121 | { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) }, |
120 | { "Access", OSD.FromInteger(regionInfo.Access) }, | 122 | { "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 | |||
348 | 348 | ||
349 | public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) | 349 | public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) |
350 | { | 350 | { |
351 | IPEndPoint ext = destination.ExternalEndPoint; | ||
351 | agent = null; | 352 | agent = null; |
353 | if (ext == null) return false; | ||
352 | // Eventually, we want to use a caps url instead of the agentID | 354 | // Eventually, we want to use a caps url instead of the agentID |
353 | string uri = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | 355 | string uri = "http://" + ext.Address + ":" + destination.HttpPort + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; |
354 | //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); | 356 | //Console.WriteLine(" >>> DoRetrieveRootAgentCall <<< " + uri); |
355 | 357 | ||
356 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); | 358 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); |
@@ -514,8 +516,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
514 | 516 | ||
515 | public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) | 517 | public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) |
516 | { | 518 | { |
519 | IPEndPoint ext = destination.ExternalEndPoint; | ||
520 | if (ext == null) return false; | ||
517 | string uri | 521 | string uri |
518 | = "http://" + destination.ExternalEndPoint.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; | 522 | = "http://" + ext.Address + ":" + destination.HttpPort + ObjectPath() + sog.UUID + "/"; |
519 | //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); | 523 | //m_log.Debug(" >>> DoCreateObjectCall <<< " + uri); |
520 | 524 | ||
521 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); | 525 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); |
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index e55b633..94cee57 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -259,9 +259,13 @@ namespace OpenSim.Services.Interfaces | |||
259 | } | 259 | } |
260 | catch (SocketException e) | 260 | catch (SocketException e) |
261 | { | 261 | { |
262 | throw new Exception( | 262 | /*throw new Exception( |
263 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + | 263 | "Unable to resolve local hostname " + m_externalHostName + " innerException of type '" + |
264 | e + "' attached to this exception", e); | 264 | e + "' attached to this exception", e);*/ |
265 | // Don't throw a fatal exception here, instead, return Null and handle it in the caller. | ||
266 | // Reason is, on systems such as OSgrid it has occured that known hostnames stop | ||
267 | // resolving and thus make surrounding regions crash out with this exception. | ||
268 | return null; | ||
265 | } | 269 | } |
266 | 270 | ||
267 | return new IPEndPoint(ia, m_internalEndPoint.Port); | 271 | return new IPEndPoint(ia, m_internalEndPoint.Port); |
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index edf41bc..6a2cbeb 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -327,6 +327,7 @@ namespace OpenSim.Services.LLLoginService | |||
327 | private void FillOutRegionData(GridRegion destination) | 327 | private void FillOutRegionData(GridRegion destination) |
328 | { | 328 | { |
329 | IPEndPoint endPoint = destination.ExternalEndPoint; | 329 | IPEndPoint endPoint = destination.ExternalEndPoint; |
330 | if (endPoint == null) return; | ||
330 | SimAddress = endPoint.Address.ToString(); | 331 | SimAddress = endPoint.Address.ToString(); |
331 | SimPort = (uint)endPoint.Port; | 332 | SimPort = (uint)endPoint.Port; |
332 | RegionX = (uint)destination.RegionLocX; | 333 | RegionX = (uint)destination.RegionLocX; |