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 =
new ExpiringCache<UUID, ExpiringCache<ulong, DateTime>>();
private IEventQueue m_eqModule;
#region ISharedRegionModule
public Type ReplaceableInterface
@ -147,7 +149,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
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
@ -392,8 +400,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return;
}
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
uint newRegionX = (uint)(reg.RegionHandle >> 40);
uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
uint oldRegionX = (uint)(sp.Scene.RegionInfo.RegionHandle >> 40);
@ -510,16 +516,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
#endregion
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,
// which triggers a bunch of things there.
// So let's wait
Thread.Sleep(200);
eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
}
else
@ -558,10 +564,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}",
capsPath, sp.Scene.RegionInfo.RegionName, sp.Name);
if (eq != null)
if (m_eqModule != null)
{
eq.TeleportFinishEvent(destinationHandle, 13, endPoint,
0, teleportFlags, capsPath, sp.UUID);
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID);
}
else
{
@ -1116,11 +1121,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
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 (eq != null)
if (m_eqModule != null)
{
eq.CrossRegion(neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId);
m_eqModule.CrossRegion(
neighbourHandle, pos, vel2 /* agent.Velocity */, neighbourRegion.ExternalEndPoint,
capsPath, agent.UUID, agent.ControllingClient.SessionId);
}
else
{
@ -1468,8 +1473,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (regionAccepted && newAgent)
{
IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
if (m_eqModule != null)
{
#region IP Translation for NAT
IClientIPEndpoint ipepClient;
@ -1483,8 +1487,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
"and EstablishAgentCommunication with seed cap {4}",
scene.RegionInfo.RegionName, sp.Name, reg.RegionName, reg.RegionHandle, capsPath);
eq.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID);
eq.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
m_eqModule.EnableSimulator(reg.RegionHandle, endPoint, sp.UUID);
m_eqModule.EstablishAgentCommunication(sp.UUID, endPoint, capsPath);
}
else
{