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/Hypergrid/HGSceneCommunicationService.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Hypergrid') diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs index d4f66c7..0ee0869 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGSceneCommunicationService.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; +using System.Net; using System.Reflection; using System.Threading; @@ -148,6 +149,16 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid 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) { @@ -206,15 +217,15 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid if (eq != null) { - OSD Item = EventQueueHelper.EnableSimulator(realHandle, reg.ExternalEndPoint); + OSD Item = EventQueueHelper.EnableSimulator(realHandle, 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(realHandle, reg.ExternalEndPoint); + avatar.ControllingClient.InformClientOfNeighbour(realHandle, endPoint); // TODO: make Event Queue disablable! } } @@ -252,13 +263,13 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid /// if (eq != null) { - OSD Item = EventQueueHelper.TeleportFinishEvent(realHandle, 13, reg.ExternalEndPoint, + OSD Item = EventQueueHelper.TeleportFinishEvent(realHandle, 13, endPoint, 4, teleportFlags, capsPath, avatar.UUID); eq.Enqueue(Item, avatar.UUID); } else { - avatar.ControllingClient.SendRegionTeleport(realHandle, 13, reg.ExternalEndPoint, 4, + avatar.ControllingClient.SendRegionTeleport(realHandle, 13, endPoint, 4, teleportFlags, capsPath); } /// -- cgit v1.1