From 6a8b8f3168d251d152fdeac007ab7a3f7a280e39 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 2 Dec 2016 22:56:14 +0000 Subject: [PATCH] change a wrong error message and avoid a null ref (that may happen due to needed time delays) --- .../EntityTransfer/EntityTransferModule.cs | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 33aa7adfc9..a7105e2bb2 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -2093,19 +2093,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer spScene.SimulationService.UpdateAgent(neighbour, agentpos); } } - catch (ArgumentOutOfRangeException) - { - m_log.ErrorFormat( - "[ENTITY TRANSFER MODULE]: Neighbour Regions response included the current region in the neighbour list. The following region will not display to the client: {0} for region {1} ({2}, {3}).", - neighbour.ExternalHostName, - neighbour.RegionHandle, - neighbour.RegionLocX, - neighbour.RegionLocY); - } catch (Exception e) { m_log.ErrorFormat( - "[ENTITY TRANSFER MODULE]: Could not resolve external hostname {0} for region {1} ({2}, {3}). {4}", + "[ENTITY TRANSFER MODULE]: Error creating child agent at {0} ({1} ({2}, {3}). {4}", neighbour.ExternalHostName, neighbour.RegionHandle, neighbour.RegionLocX, @@ -2279,24 +2270,28 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// /// /// - private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData a, GridRegion reg, + private void InformClientOfNeighbourAsync(ScenePresence sp, AgentCircuitData agentCircData, GridRegion reg, IPEndPoint endPoint, bool newAgent) { if (newAgent) { + // we may already had lost this sp + if(sp == null || sp.IsDeleted || sp.ClientView == null) // something bad already happened + return; + Scene scene = sp.Scene; m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Informing {0} {1} about neighbour {2} {3} at ({4},{5})", sp.Name, sp.UUID, reg.RegionName, endPoint, reg.RegionCoordX, reg.RegionCoordY); - string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(a.CapsPath); + string capsPath = reg.ServerURI + CapsUtil.GetCapsSeedPath(agentCircData.CapsPath); string reason = String.Empty; EntityTransferContext ctx = new EntityTransferContext(); - bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, a, (uint)TeleportFlags.Default, ctx, out reason); + bool regionAccepted = scene.SimulationService.CreateAgent(reg, reg, agentCircData, (uint)TeleportFlags.Default, ctx, out reason); if (regionAccepted) { @@ -2306,6 +2301,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (m_eqModule != null) { #region IP Translation for NAT + if(sp == null || sp.IsDeleted || sp.ClientView == null) // something bad already happened + return; + IClientIPEndpoint ipepClient; if (sp.ClientView.TryGet(out ipepClient)) {