Now that the EntityTransferModule is per-region, fetch the event queue module once rather than repeatedly via scene presences

0.7.3-extended
Justin Clark-Casey (justincc) 2012-05-24 22:40:24 +01:00
parent 5c48c3c57a
commit cd61567de8
1 changed files with 22 additions and 18 deletions

View File

@ -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
@ -392,8 +400,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return; return;
} }
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
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);
@ -510,16 +516,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
@ -558,10 +564,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
{ {
@ -1116,10 +1121,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
@ -1468,8 +1473,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;
@ -1483,8 +1487,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
{ {