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.

0.6.1-post-fixes
diva 2008-12-20 18:15:02 +00:00
parent 1e723f185a
commit fcf61c4d0d
3 changed files with 36 additions and 13 deletions

View File

@ -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);
}
///

View File

@ -2673,7 +2673,7 @@ namespace OpenSim.Region.Environment.Scenes
m_sceneGridService.OnRegionUp += OtherRegionUp;
m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
//m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar;
m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid;
m_sceneGridService.KiPrimitive += SendKillObject;
m_sceneGridService.OnGetLandData += GetLandData;
@ -2686,7 +2686,7 @@ namespace OpenSim.Region.Environment.Scenes
{
m_sceneGridService.KiPrimitive -= SendKillObject;
m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid;
m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
//m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar;
m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
m_sceneGridService.OnRegionUp -= OtherRegionUp;

View File

@ -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);
}