add some checks for valid endpoints
parent
772c5b7db0
commit
31b4a31246
|
@ -527,15 +527,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId);
|
string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId);
|
||||||
|
|
||||||
string message;
|
string reason = String.Empty;
|
||||||
finalDestination = GetFinalDestination(reg, sp.ControllingClient.AgentId, homeURI, out message);
|
finalDestination = GetFinalDestination(reg, sp.ControllingClient.AgentId, homeURI, out reason);
|
||||||
|
|
||||||
if (finalDestination == null)
|
if (finalDestination == null)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat( "{0} Final destination is having problems. Unable to teleport {1} {2}: {3}",
|
m_log.WarnFormat( "{0} Final destination is having problems. Unable to teleport {1} {2}: {3}",
|
||||||
LogHeader, sp.Name, sp.UUID, message);
|
LogHeader, sp.Name, sp.UUID, reason);
|
||||||
|
|
||||||
sp.ControllingClient.SendTeleportFailed(message);
|
sp.ControllingClient.SendTeleportFailed(reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,17 +548,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate assorted conditions
|
|
||||||
string reason = string.Empty;
|
|
||||||
if (!ValidateGenericConditions(sp, reg, finalDestination, teleportFlags, out reason))
|
if (!ValidateGenericConditions(sp, reg, finalDestination, teleportFlags, out reason))
|
||||||
{
|
{
|
||||||
sp.ControllingClient.SendTeleportFailed(reason);
|
sp.ControllingClient.SendTeleportFailed(reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message != null)
|
|
||||||
sp.ControllingClient.SendAgentAlertMessage(message, true);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is it
|
// This is it
|
||||||
//
|
//
|
||||||
|
@ -735,8 +730,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
IPEndPoint endPoint = finalDestination.ExternalEndPoint;
|
IPEndPoint endPoint = finalDestination.ExternalEndPoint;
|
||||||
if (endPoint == null || endPoint.Address == null)
|
if (endPoint == null || endPoint.Address == null)
|
||||||
{
|
{
|
||||||
sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
|
sp.ControllingClient.SendTeleportFailed("Could not resolve destination Address");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,22 +778,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// At least on LL 3.3.4, this is not strictly necessary - a teleport will succeed without sending this to
|
// At least on LL 3.3.4, this is not strictly necessary - a teleport will succeed without sending this to
|
||||||
// the viewer. However, it might mean that the viewer does not see the black teleport screen (untested).
|
// the viewer. However, it might mean that the viewer does not see the black teleport screen (untested).
|
||||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||||
|
|
||||||
// the avatar.Close below will clear the child region list. We need this below for (possibly)
|
|
||||||
// closing the child agents, so save it here (we need a copy as it is Clear()-ed).
|
|
||||||
//List<ulong> childRegions = avatar.KnownRegionHandles;
|
|
||||||
// Compared to ScenePresence.CrossToNewRegion(), there's no obvious code to handle a teleport
|
|
||||||
// failure at this point (unlike a border crossing failure). So perhaps this can never fail
|
|
||||||
// once we reach here...
|
|
||||||
//avatar.Scene.RemoveCapsHandler(avatar.UUID);
|
|
||||||
|
|
||||||
AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
|
||||||
AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo();
|
AgentCircuitData agentCircuit = sp.ControllingClient.RequestClientInfo();
|
||||||
agentCircuit.startpos = position;
|
agentCircuit.startpos = position;
|
||||||
agentCircuit.child = true;
|
agentCircuit.child = true;
|
||||||
|
|
||||||
// agentCircuit.Appearance = sp.Appearance;
|
|
||||||
// agentCircuit.Appearance = new AvatarAppearance(sp.Appearance, true, false);
|
|
||||||
agentCircuit.Appearance = new AvatarAppearance();
|
agentCircuit.Appearance = new AvatarAppearance();
|
||||||
agentCircuit.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
|
agentCircuit.Appearance.AvatarHeight = sp.Appearance.AvatarHeight;
|
||||||
|
|
||||||
|
@ -1673,6 +1657,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return agent;
|
return agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IPEndPoint endpoint = neighbourRegion.ExternalEndPoint;
|
||||||
|
if(endpoint == null)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("{0}: CrossAgentToNewRegionAsync: failed to resolve neighbour address {0} ",neighbourRegion.ExternalHostName);
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
|
||||||
m_entityTransferStateMachine.SetInTransit(agent.UUID);
|
m_entityTransferStateMachine.SetInTransit(agent.UUID);
|
||||||
agent.RemoveFromPhysicalScene();
|
agent.RemoveFromPhysicalScene();
|
||||||
|
|
||||||
|
@ -1683,7 +1674,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
return agent;
|
return agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
CrossAgentToNewRegionPost(agent, pos, neighbourRegion, isFlying, ctx);
|
CrossAgentToNewRegionPost(agent, pos, neighbourRegion, endpoint, isFlying, ctx);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1727,6 +1718,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
agent.AddNeighbourRegion(neighbourRegion, agentCircuit.CapsPath);
|
agent.AddNeighbourRegion(neighbourRegion, agentCircuit.CapsPath);
|
||||||
|
|
||||||
IPEndPoint endPoint = neighbourRegion.ExternalEndPoint;
|
IPEndPoint endPoint = neighbourRegion.ExternalEndPoint;
|
||||||
|
if(endPoint == null)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("CrossAgentCreateFarChild failed to resolve neighbour address {0}", neighbourRegion.ExternalHostName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason))
|
if (Scene.SimulationService.CreateAgent(source, neighbourRegion, agentCircuit, (int)TeleportFlags.Default, ctx, out reason))
|
||||||
{
|
{
|
||||||
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
||||||
|
@ -1821,7 +1817,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
|
public void CrossAgentToNewRegionPost(ScenePresence agent, Vector3 pos, GridRegion neighbourRegion,
|
||||||
bool isFlying, EntityTransferContext ctx)
|
IPEndPoint endpoint, bool isFlying, EntityTransferContext ctx)
|
||||||
{
|
{
|
||||||
|
|
||||||
string agentcaps;
|
string agentcaps;
|
||||||
|
@ -1848,15 +1844,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
m_eqModule.CrossRegion(
|
m_eqModule.CrossRegion(
|
||||||
neighbourRegion.RegionHandle, pos, vel2 /* agent.Velocity */,
|
neighbourRegion.RegionHandle, pos, vel2 /* agent.Velocity */,
|
||||||
neighbourRegion.ExternalEndPoint,
|
endpoint, capsPath, agent.UUID, agent.ControllingClient.SessionId,
|
||||||
capsPath, agent.UUID, agent.ControllingClient.SessionId,
|
|
||||||
neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
|
neighbourRegion.RegionSizeX, neighbourRegion.RegionSizeY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("{0} Using old CrossRegion packet. Varregion will not work!!", LogHeader);
|
m_log.ErrorFormat("{0} Using old CrossRegion packet. Varregion will not work!!", LogHeader);
|
||||||
agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint,
|
agent.ControllingClient.CrossRegion(neighbourRegion.RegionHandle, pos, agent.Velocity,
|
||||||
capsPath);
|
endpoint,capsPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SUCCESS!
|
// SUCCESS!
|
||||||
|
@ -1953,7 +1948,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
seeds.Add(regionhandler, agent.CapsPath);
|
seeds.Add(regionhandler, agent.CapsPath);
|
||||||
|
|
||||||
|
|
||||||
// agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
|
// agent.ChildrenCapSeeds = new Dictionary<ulong, string>(seeds);
|
||||||
agent.ChildrenCapSeeds = null;
|
agent.ChildrenCapSeeds = null;
|
||||||
|
|
||||||
|
|
|
@ -271,31 +271,6 @@ namespace OpenSim.Services.Interfaces
|
||||||
m_serverURI = string.Empty;
|
m_serverURI = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri)
|
|
||||||
{
|
|
||||||
m_regionLocX = regionLocX;
|
|
||||||
m_regionLocY = regionLocY;
|
|
||||||
RegionSizeX = (int)Constants.RegionSize;
|
|
||||||
RegionSizeY = (int)Constants.RegionSize;
|
|
||||||
|
|
||||||
m_internalEndPoint = internalEndPoint;
|
|
||||||
m_externalHostName = externalUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GridRegion(int regionLocX, int regionLocY, string externalUri, uint port)
|
|
||||||
{
|
|
||||||
m_regionLocX = regionLocX;
|
|
||||||
m_regionLocY = regionLocY;
|
|
||||||
RegionSizeX = (int)Constants.RegionSize;
|
|
||||||
RegionSizeY = (int)Constants.RegionSize;
|
|
||||||
|
|
||||||
m_externalHostName = externalUri;
|
|
||||||
|
|
||||||
m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public GridRegion(uint xcell, uint ycell)
|
public GridRegion(uint xcell, uint ycell)
|
||||||
{
|
{
|
||||||
m_regionLocX = (int)Util.RegionToWorldLoc(xcell);
|
m_regionLocX = (int)Util.RegionToWorldLoc(xcell);
|
||||||
|
@ -489,14 +464,16 @@ namespace OpenSim.Services.Interfaces
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
// Old one defaults to IPv6
|
|
||||||
//return new IPEndPoint(Dns.GetHostAddresses(m_externalHostName)[0], m_internalEndPoint.Port);
|
|
||||||
|
|
||||||
IPAddress ia = null;
|
IPAddress ia = null;
|
||||||
// If it is already an IP, don't resolve it - just return directly
|
// If it is already an IP, don't resolve it - just return directly
|
||||||
|
// we should not need this
|
||||||
if (IPAddress.TryParse(m_externalHostName, out ia))
|
if (IPAddress.TryParse(m_externalHostName, out ia))
|
||||||
|
{
|
||||||
|
if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
|
||||||
|
return null;
|
||||||
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
||||||
|
}
|
||||||
|
|
||||||
// Reset for next check
|
// Reset for next check
|
||||||
ia = null;
|
ia = null;
|
||||||
try
|
try
|
||||||
|
@ -513,7 +490,7 @@ namespace OpenSim.Services.Interfaces
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SocketException e)
|
catch // (SocketException e)
|
||||||
{
|
{
|
||||||
/*throw new Exception(
|
/*throw new Exception(
|
||||||
"Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
|
"Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
|
||||||
|
@ -524,6 +501,9 @@ namespace OpenSim.Services.Interfaces
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ia == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
return new IPEndPoint(ia, m_internalEndPoint.Port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue