From fcf61c4d0db38e39e1db9e54602290ab0f1f1204 Mon Sep 17 00:00:00 2001 From: diva Date: Sat, 20 Dec 2008 18:15:02 +0000 Subject: This reduces DNS lookups in TPs by a factor of 4. Let's see if this fixes some of the crashes experienced by ppl in Europe connected to OSGrid. If DNS lookup does not resolve, they may experience a substantial increase in "Region not available", but they shouldn't crash. --- .../Scenes/SceneCommunicationService.cs | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index 1d50865..2bfb7d6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.Environment.Scenes public event PrimCrossing OnPrimCrossingIntoRegion; public event RegionUp OnRegionUp; public event ChildAgentUpdate OnChildAgentUpdate; - public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; + //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; public event LogOffUser OnLogOffUser; public event GetLandData OnGetLandData; @@ -729,6 +729,7 @@ namespace OpenSim.Region.Environment.Scenes { // region is remote. see if it is up destRegionUp = m_commsProvider.InterRegion.CheckRegion(reg.RemotingAddress, reg.RemotingPort); + } else { @@ -736,6 +737,16 @@ namespace OpenSim.Region.Environment.Scenes destRegionUp = true; } + // Let's do DNS resolution only once in this process, please! + // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, + // it's actually doing a lot of work. + IPEndPoint endPoint = reg.ExternalEndPoint; + if (endPoint.Address == null) + { + // Couldn't resolve the name. Can't TP, because the viewer wants IP addresses. + destRegionUp = false; + } + if (destRegionUp) { uint newRegionX = (uint)(reg.RegionHandle >> 40); @@ -761,6 +772,7 @@ namespace OpenSim.Region.Environment.Scenes // once we reach here... //avatar.Scene.RemoveCapsHandler(avatar.UUID); + // Let's close some agents avatar.CloseChildAgents(newRegionX, newRegionY); @@ -791,15 +803,15 @@ namespace OpenSim.Region.Environment.Scenes if (eq != null) { - OSD Item = EventQueueHelper.EnableSimulator(reg.RegionHandle, reg.ExternalEndPoint); + OSD Item = EventQueueHelper.EnableSimulator(reg.RegionHandle, endPoint); eq.Enqueue(Item, avatar.UUID); - Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, reg.ExternalEndPoint.ToString(), capsPath); + Item = EventQueueHelper.EstablishAgentCommunication(avatar.UUID, endPoint.ToString(), capsPath); eq.Enqueue(Item, avatar.UUID); } else { - avatar.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, reg.ExternalEndPoint); + avatar.ControllingClient.InformClientOfNeighbour(reg.RegionHandle, endPoint); } } else @@ -829,13 +841,13 @@ namespace OpenSim.Region.Environment.Scenes if (eq != null) { - OSD Item = EventQueueHelper.TeleportFinishEvent(reg.RegionHandle, 13, reg.ExternalEndPoint, + OSD Item = EventQueueHelper.TeleportFinishEvent(reg.RegionHandle, 13, endPoint, 4, teleportFlags, capsPath, avatar.UUID); eq.Enqueue(Item, avatar.UUID); } else { - avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, reg.ExternalEndPoint, 4, + avatar.ControllingClient.SendRegionTeleport(reg.RegionHandle, 13, endPoint, 4, teleportFlags, capsPath); } -- cgit v1.1