On entity transfer of scene presence, replace polling sleep in SP.WaitForUpdateAgent() with a triggered event instead.
Rapid polls are more expensive than triggered events (several polls vs one trigger) and may be problematic on heavily loaded simulators where many threads are vying for processor time. A triggered event is also slightly quicker as there is no maximum 200ms wait between polls.bullet-2.82
parent
0d2a25b477
commit
bc0895c758
|
@ -343,6 +343,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private object m_originRegionIDAccessLock = new object();
|
private object m_originRegionIDAccessLock = new object();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Triggered on entity transfer after to allow CompleteMovement() to proceed after we have received an
|
||||||
|
/// UpdateAgent from the originating region.ddkjjkj
|
||||||
|
/// </summary>
|
||||||
|
private AutoResetEvent m_updateAgentReceivedAfterTransferEvent = new AutoResetEvent(false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used by the entity transfer module to signal when the presence should not be closed because a subsequent
|
/// Used by the entity transfer module to signal when the presence should not be closed because a subsequent
|
||||||
/// teleport is reusing the connection.
|
/// teleport is reusing the connection.
|
||||||
|
@ -1648,8 +1654,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// For the moment, just set the size as passed.
|
// For the moment, just set the size as passed.
|
||||||
PhysicsActor.Size = size;
|
PhysicsActor.Size = size;
|
||||||
// PhysicsActor.setAvatarSize(size, feetoffset);
|
// PhysicsActor.setAvatarSize(size, feetoffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool WaitForUpdateAgent(IClientAPI client)
|
private bool WaitForUpdateAgent(IClientAPI client)
|
||||||
|
@ -1658,20 +1663,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination,
|
// (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination,
|
||||||
// m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the
|
// m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the
|
||||||
// viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero
|
// viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero
|
||||||
int count = 50;
|
m_updateAgentReceivedAfterTransferEvent.WaitOne(10000);
|
||||||
UUID originID;
|
|
||||||
|
UUID originID = UUID.Zero;
|
||||||
|
|
||||||
lock (m_originRegionIDAccessLock)
|
lock (m_originRegionIDAccessLock)
|
||||||
originID = m_originRegionID;
|
originID = m_originRegionID;
|
||||||
|
|
||||||
while (originID.Equals(UUID.Zero) && count-- > 0)
|
|
||||||
{
|
|
||||||
lock (m_originRegionIDAccessLock)
|
|
||||||
originID = m_originRegionID;
|
|
||||||
|
|
||||||
m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name);
|
|
||||||
Thread.Sleep(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (originID.Equals(UUID.Zero))
|
if (originID.Equals(UUID.Zero))
|
||||||
{
|
{
|
||||||
|
@ -3820,6 +3817,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CopyFrom(cAgentData);
|
CopyFrom(cAgentData);
|
||||||
|
|
||||||
|
m_updateAgentReceivedAfterTransferEvent.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector3 marker = new Vector3(-1f, -1f, -1f);
|
private static Vector3 marker = new Vector3(-1f, -1f, -1f);
|
||||||
|
|
Loading…
Reference in New Issue