Merge branch 'master' of /home/opensim/var/repo/opensim
commit
bd5a298a2d
|
@ -73,6 +73,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions =
|
private ExpiringCache<UUID, ExpiringCache<ulong, DateTime>> m_bannedRegions =
|
||||||
new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
|
new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
|
||||||
|
|
||||||
|
private IEventQueue m_eqModule;
|
||||||
|
|
||||||
#region ISharedRegionModule
|
#region ISharedRegionModule
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
|
@ -147,7 +149,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
public virtual void RemoveRegion(Scene scene) {}
|
public virtual void RemoveRegion(Scene scene) {}
|
||||||
|
|
||||||
public virtual void RegionLoaded(Scene scene) {}
|
public virtual void RegionLoaded(Scene scene)
|
||||||
|
{
|
||||||
|
if (!m_Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_eqModule = m_scene.RequestModuleInterface<IEventQueue>();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -219,6 +227,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ENTITY TRANSFER MODULE]: Ignoring within region teleport request of {0} {1} to {2} - agent is already in transit.",
|
"[ENTITY TRANSFER MODULE]: Ignoring within region teleport request of {0} {1} to {2} - agent is already in transit.",
|
||||||
sp.Name, sp.UUID, position);
|
sp.Name, sp.UUID, position);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Teleport within the same region
|
// Teleport within the same region
|
||||||
|
@ -358,6 +368,30 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
ScenePresence sp, GridRegion reg, GridRegion finalDestination,
|
ScenePresence sp, GridRegion reg, GridRegion finalDestination,
|
||||||
Vector3 position, Vector3 lookAt, uint teleportFlags)
|
Vector3 position, Vector3 lookAt, uint teleportFlags)
|
||||||
{
|
{
|
||||||
|
// Record that this agent is in transit so that we can prevent simultaneous requests and do later detection
|
||||||
|
// of whether the destination region completes the teleport.
|
||||||
|
if (!SetInTransit(sp.UUID))
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
|
||||||
|
sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reg == null || finalDestination == null)
|
||||||
|
{
|
||||||
|
sp.ControllingClient.SendTeleportFailed("Unable to locate destination");
|
||||||
|
ResetFromTransit(sp.UUID);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[ENTITY TRANSFER MODULE]: Teleporting {0} {1} from {2} to {3} ({4}) {5}/{6}",
|
||||||
|
sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName,
|
||||||
|
reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
|
||||||
|
|
||||||
RegionInfo sourceRegion = sp.Scene.RegionInfo;
|
RegionInfo sourceRegion = sp.Scene.RegionInfo;
|
||||||
|
|
||||||
if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination))
|
if (!IsWithinMaxTeleportDistance(sourceRegion, finalDestination))
|
||||||
|
@ -369,31 +403,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY,
|
sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY,
|
||||||
MaxTransferDistance));
|
MaxTransferDistance));
|
||||||
|
|
||||||
return;
|
ResetFromTransit(sp.UUID);
|
||||||
}
|
|
||||||
|
|
||||||
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
|
|
||||||
|
|
||||||
if (reg == null || finalDestination == null)
|
|
||||||
{
|
|
||||||
sp.ControllingClient.SendTeleportFailed("Unable to locate destination");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SetInTransit(sp.UUID)) // Avie is already on the way. Caller shouldn't do this.
|
|
||||||
{
|
|
||||||
m_log.DebugFormat(
|
|
||||||
"[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
|
|
||||||
sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.DebugFormat(
|
|
||||||
"[ENTITY TRANSFER MODULE]: Teleporting {0} {1} from {2} to {3} ({4}) {5}/{6}",
|
|
||||||
sp.Name, sp.UUID, sp.Scene.RegionInfo.RegionName,
|
|
||||||
reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
|
|
||||||
|
|
||||||
uint newRegionX = (uint)(reg.RegionHandle >> 40);
|
uint newRegionX = (uint)(reg.RegionHandle >> 40);
|
||||||
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
|
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
|
||||||
uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40);
|
uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40);
|
||||||
|
@ -405,12 +419,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// This may be a costly operation. The reg.ExternalEndPoint field is not a passive field,
|
// This may be a costly operation. The reg.ExternalEndPoint field is not a passive field,
|
||||||
// it's actually doing a lot of work.
|
// it's actually doing a lot of work.
|
||||||
IPEndPoint endPoint = finalDestination.ExternalEndPoint;
|
IPEndPoint endPoint = finalDestination.ExternalEndPoint;
|
||||||
if (endPoint.Address != null)
|
|
||||||
|
if (endPoint.Address == null)
|
||||||
{
|
{
|
||||||
// Fixing a bug where teleporting while sitting results in the avatar ending up removed from
|
sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
|
||||||
// both regions
|
ResetFromTransit(sp.UUID);
|
||||||
if (sp.ParentID != (uint)0)
|
|
||||||
sp.StandUp();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!sp.ValidateAttachments())
|
if (!sp.ValidateAttachments())
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
|
@ -440,6 +456,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
|
||||||
|
|
||||||
|
// Fixing a bug where teleporting while sitting results in the avatar ending up removed from
|
||||||
|
// both regions
|
||||||
|
if (sp.ParentID != (uint)0)
|
||||||
|
sp.StandUp();
|
||||||
|
|
||||||
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
sp.ControllingClient.SendTeleportStart(teleportFlags);
|
||||||
|
|
||||||
// the avatar.Close below will clear the child region list. We need this below for (possibly)
|
// the avatar.Close below will clear the child region list. We need this below for (possibly)
|
||||||
|
@ -503,16 +524,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
#endregion
|
#endregion
|
||||||
capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
capsPath = finalDestination.ServerURI + CapsUtil.GetCapsSeedPath(agentCircuit.CapsPath);
|
||||||
|
|
||||||
if (eq != null)
|
if (m_eqModule != null)
|
||||||
{
|
{
|
||||||
eq.EnableSimulator(destinationHandle, endPoint, sp.UUID);
|
m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID);
|
||||||
|
|
||||||
// ES makes the client send a UseCircuitCode message to the destination,
|
// ES makes the client send a UseCircuitCode message to the destination,
|
||||||
// which triggers a bunch of things there.
|
// which triggers a bunch of things there.
|
||||||
// So let's wait
|
// So let's wait
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
|
|
||||||
eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
|
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -551,10 +572,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}",
|
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}",
|
||||||
capsPath, sp.Scene.RegionInfo.RegionName, sp.Name);
|
capsPath, sp.Scene.RegionInfo.RegionName, sp.Name);
|
||||||
|
|
||||||
if (eq != null)
|
if (m_eqModule != null)
|
||||||
{
|
{
|
||||||
eq.TeleportFinishEvent(destinationHandle, 13, endPoint,
|
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID);
|
||||||
0, teleportFlags, capsPath, sp.UUID);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -625,11 +645,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
sp.UUID);
|
sp.UUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
|
protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
|
||||||
{
|
{
|
||||||
|
@ -1114,10 +1129,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
|
||||||
|
|
||||||
IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>();
|
if (m_eqModule != null)
|
||||||
if (eq != null)
|
|
||||||
{
|
{
|
||||||
eq.CrossRegion(neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint,
|
m_eqModule.CrossRegion(
|
||||||
|
neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint,
|
||||||
capsPath, agent.UUID, agent.ControllingClient.SessionId);
|
capsPath, agent.UUID, agent.ControllingClient.SessionId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1466,8 +1481,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
|
|
||||||
if (regionAccepted && newAgent)
|
if (regionAccepted && newAgent)
|
||||||
{
|
{
|
||||||
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
|
if (m_eqModule != null)
|
||||||
if (eq != null)
|
|
||||||
{
|
{
|
||||||
#region IP Translation for NAT
|
#region IP Translation for NAT
|
||||||
IClientIPEndpoint ipepClient;
|
IClientIPEndpoint ipepClient;
|
||||||
|
@ -1481,8 +1495,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
"and EstablishAgentCommunication with seed cap {4}",
|
"and EstablishAgentCommunication with seed cap {4}",
|
||||||
scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath);
|
scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath);
|
||||||
|
|
||||||
eq.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID);
|
m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID);
|
||||||
eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
|
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue