aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs63
1 files changed, 48 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 183d8d1..9f330fd 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -320,7 +320,21 @@ namespace OpenSim.Region.Framework.Scenes
320 /// </summary> 320 /// </summary>
321 private string m_callbackURI; 321 private string m_callbackURI;
322 322
323 public UUID m_originRegionID; 323 /// <summary>
324 /// Records the region from which this presence originated, if not from login.
325 /// </summary>
326 /// <remarks>
327 /// Also acts as a signal in the teleport V2 process to release UpdateAgent after a viewer has triggered
328 /// CompleteMovement and made the previous child agent a root agent.
329 /// </remarks>
330 private UUID m_originRegionID;
331
332 /// <summary>
333 /// This object is used as a lock before accessing m_originRegionID to make sure that every thread is seeing
334 /// the very latest value and not using some cached version. Cannot make m_originRegionID itself volatite as
335 /// it is a value type.
336 /// </summary>
337 private object m_originRegionIDAccessLock = new object();
324 338
325 /// <summary> 339 /// <summary>
326 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent 340 /// Used by the entity transfer module to signal when the presence should not be closed because a subsequent
@@ -975,11 +989,11 @@ namespace OpenSim.Region.Framework.Scenes
975 /// This method is on the critical path for transferring an avatar from one region to another. Delay here 989 /// This method is on the critical path for transferring an avatar from one region to another. Delay here
976 /// delays that crossing. 990 /// delays that crossing.
977 /// </summary> 991 /// </summary>
978 public void MakeRootAgent(Vector3 pos, bool isFlying) 992 private void MakeRootAgent(Vector3 pos, bool isFlying)
979 { 993 {
980 m_log.InfoFormat( 994// m_log.InfoFormat(
981 "[SCENE]: Upgrading child to root agent for {0} in {1}", 995// "[SCENE]: Upgrading child to root agent for {0} in {1}",
982 Name, m_scene.RegionInfo.RegionName); 996// Name, m_scene.RegionInfo.RegionName);
983 997
984 if (ParentUUID != UUID.Zero) 998 if (ParentUUID != UUID.Zero)
985 { 999 {
@@ -1545,15 +1559,26 @@ namespace OpenSim.Region.Framework.Scenes
1545 1559
1546 private bool WaitForUpdateAgent(IClientAPI client) 1560 private bool WaitForUpdateAgent(IClientAPI client)
1547 { 1561 {
1548 // Before UpdateAgent, m_originRegionID is UUID.Zero; after, it's non-Zero 1562 // Before the source region executes UpdateAgent
1563 // (which triggers Scene.IncomingUpdateChildAgent(AgentData cAgentData) here in the destination,
1564 // m_originRegionID is UUID.Zero; after, it's non-Zero. The CompleteMovement sequence initiated from the
1565 // viewer (in turn triggered by the source region sending it a TeleportFinish event) waits until it's non-zero
1549 int count = 50; 1566 int count = 50;
1550 while (m_originRegionID.Equals(UUID.Zero) && count-- > 0) 1567 UUID originID;
1568
1569 lock (m_originRegionIDAccessLock)
1570 originID = m_originRegionID;
1571
1572 while (originID.Equals(UUID.Zero) && count-- > 0)
1551 { 1573 {
1574 lock (m_originRegionIDAccessLock)
1575 originID = m_originRegionID;
1576
1552 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name); 1577 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.Name);
1553 Thread.Sleep(200); 1578 Thread.Sleep(200);
1554 } 1579 }
1555 1580
1556 if (m_originRegionID.Equals(UUID.Zero)) 1581 if (originID.Equals(UUID.Zero))
1557 { 1582 {
1558 // Movement into region will fail 1583 // Movement into region will fail
1559 m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived in {1}", client.Name, Scene.Name); 1584 m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived in {1}", client.Name, Scene.Name);
@@ -1576,9 +1601,9 @@ namespace OpenSim.Region.Framework.Scenes
1576 { 1601 {
1577// DateTime startTime = DateTime.Now; 1602// DateTime startTime = DateTime.Now;
1578 1603
1579 m_log.DebugFormat( 1604 m_log.InfoFormat(
1580 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}", 1605 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
1581 client.Name, Scene.RegionInfo.RegionName, AbsolutePosition); 1606 client.Name, Scene.Name, AbsolutePosition);
1582 1607
1583 // Make sure it's not a login agent. We don't want to wait for updates during login 1608 // Make sure it's not a login agent. We don't want to wait for updates during login
1584 if (PresenceType != PresenceType.Npc && (m_teleportFlags & TeleportFlags.ViaLogin) == 0) 1609 if (PresenceType != PresenceType.Npc && (m_teleportFlags & TeleportFlags.ViaLogin) == 0)
@@ -1633,7 +1658,12 @@ namespace OpenSim.Region.Framework.Scenes
1633 "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}", 1658 "[SCENE PRESENCE]: Releasing {0} {1} with callback to {2}",
1634 client.Name, client.AgentId, m_callbackURI); 1659 client.Name, client.AgentId, m_callbackURI);
1635 1660
1636 Scene.SimulationService.ReleaseAgent(m_originRegionID, UUID, m_callbackURI); 1661 UUID originID;
1662
1663 lock (m_originRegionIDAccessLock)
1664 originID = m_originRegionID;
1665
1666 Scene.SimulationService.ReleaseAgent(originID, UUID, m_callbackURI);
1637 m_callbackURI = null; 1667 m_callbackURI = null;
1638 } 1668 }
1639// else 1669// else
@@ -3089,7 +3119,7 @@ namespace OpenSim.Region.Framework.Scenes
3089 // If we are using the the cached appearance then send it out to everyone 3119 // If we are using the the cached appearance then send it out to everyone
3090 if (cachedappearance) 3120 if (cachedappearance)
3091 { 3121 {
3092 m_log.DebugFormat("[SCENE PRESENCE]: baked textures are in the cache for {0}", Name); 3122 m_log.DebugFormat("[SCENE PRESENCE]: Baked textures are in the cache for {0} in {1}", Name, m_scene.Name);
3093 3123
3094 // If the avatars baked textures are all in the cache, then we have a 3124 // If the avatars baked textures are all in the cache, then we have a
3095 // complete appearance... send it out, if not, then we'll send it when 3125 // complete appearance... send it out, if not, then we'll send it when
@@ -3553,7 +3583,7 @@ namespace OpenSim.Region.Framework.Scenes
3553 3583
3554 #region Child Agent Updates 3584 #region Child Agent Updates
3555 3585
3556 public void ChildAgentDataUpdate(AgentData cAgentData) 3586 public void UpdateChildAgent(AgentData cAgentData)
3557 { 3587 {
3558// m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); 3588// m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName);
3559 if (!IsChildAgent) 3589 if (!IsChildAgent)
@@ -3563,15 +3593,17 @@ namespace OpenSim.Region.Framework.Scenes
3563 } 3593 }
3564 3594
3565 private static Vector3 marker = new Vector3(-1f, -1f, -1f); 3595 private static Vector3 marker = new Vector3(-1f, -1f, -1f);
3596
3566 private void RaiseUpdateThrottles() 3597 private void RaiseUpdateThrottles()
3567 { 3598 {
3568 m_scene.EventManager.TriggerThrottleUpdate(this); 3599 m_scene.EventManager.TriggerThrottleUpdate(this);
3569 } 3600 }
3601
3570 /// <summary> 3602 /// <summary>
3571 /// This updates important decision making data about a child agent 3603 /// This updates important decision making data about a child agent
3572 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region 3604 /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region
3573 /// </summary> 3605 /// </summary>
3574 public void ChildAgentDataUpdate(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) 3606 public void UpdateChildAgent(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
3575 { 3607 {
3576 if (!IsChildAgent) 3608 if (!IsChildAgent)
3577 return; 3609 return;
@@ -3679,7 +3711,8 @@ namespace OpenSim.Region.Framework.Scenes
3679 3711
3680 private void CopyFrom(AgentData cAgent) 3712 private void CopyFrom(AgentData cAgent)
3681 { 3713 {
3682 m_originRegionID = cAgent.RegionID; 3714 lock (m_originRegionIDAccessLock)
3715 m_originRegionID = cAgent.RegionID;
3683 3716
3684 m_callbackURI = cAgent.CallbackURI; 3717 m_callbackURI = cAgent.CallbackURI;
3685// m_log.DebugFormat( 3718// m_log.DebugFormat(