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.cs43
1 files changed, 34 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1225c2e..c78fe62 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -29,7 +29,9 @@ using System;
29using System.Xml; 29using System.Xml;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Threading;
32using System.Timers; 33using System.Timers;
34using Timer = System.Timers.Timer;
33using OpenMetaverse; 35using OpenMetaverse;
34using log4net; 36using log4net;
35using Nini.Config; 37using Nini.Config;
@@ -1154,9 +1156,8 @@ namespace OpenSim.Region.Framework.Scenes
1154 1156
1155 MovementFlag = 0; 1157 MovementFlag = 0;
1156 1158
1157 // DIVA NOTE: I moved TriggerOnMakeRootAgent out of here and into the end of 1159 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1158 // CompleteMovement. We don't want modules doing heavy computation before CompleteMovement 1160
1159 // is over.
1160 } 1161 }
1161 1162
1162 public int GetStateSource() 1163 public int GetStateSource()
@@ -1502,6 +1503,26 @@ namespace OpenSim.Region.Framework.Scenes
1502 1503
1503 } 1504 }
1504 1505
1506 private bool WaitForUpdateAgent(IClientAPI client)
1507 {
1508 // Before UpdateAgent, m_originRegionID is UUID.Zero; after, it's non-Zero
1509 int count = 20;
1510 while (m_originRegionID.Equals(UUID.Zero) && count-- > 0)
1511 {
1512 m_log.DebugFormat("[SCENE PRESENCE]: Agent {0} waiting for update in {1}", client.Name, Scene.RegionInfo.RegionName);
1513 Thread.Sleep(200);
1514 }
1515
1516 if (m_originRegionID.Equals(UUID.Zero))
1517 {
1518 // Movement into region will fail
1519 m_log.WarnFormat("[SCENE PRESENCE]: Update agent {0} never arrived", client.Name);
1520 return false;
1521 }
1522
1523 return true;
1524 }
1525
1505 /// <summary> 1526 /// <summary>
1506 /// Complete Avatar's movement into the region. 1527 /// Complete Avatar's movement into the region.
1507 /// </summary> 1528 /// </summary>
@@ -1519,6 +1540,13 @@ namespace OpenSim.Region.Framework.Scenes
1519 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}", 1540 "[SCENE PRESENCE]: Completing movement of {0} into region {1} in position {2}",
1520 client.Name, Scene.RegionInfo.RegionName, AbsolutePosition); 1541 client.Name, Scene.RegionInfo.RegionName, AbsolutePosition);
1521 1542
1543 // Make sure it's not a login agent. We don't want to wait for updates during login
1544 if ((m_teleportFlags & TeleportFlags.ViaLogin) == 0)
1545 // Let's wait until UpdateAgent (called by departing region) is done
1546 if (!WaitForUpdateAgent(client))
1547 // The sending region never sent the UpdateAgent data, we have to refuse
1548 return;
1549
1522 Vector3 look = Velocity; 1550 Vector3 look = Velocity;
1523 1551
1524 // if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1552 // if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@@ -1540,10 +1568,11 @@ namespace OpenSim.Region.Framework.Scenes
1540 1568
1541 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1569 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1542 MakeRootAgent(AbsolutePosition, flying); 1570 MakeRootAgent(AbsolutePosition, flying);
1571
1572 // Tell the client that we're totally ready
1543 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1573 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1574
1544 // Remember in HandleUseCircuitCode, we delayed this to here 1575 // Remember in HandleUseCircuitCode, we delayed this to here
1545 // This will also send the initial data to clients when TP to a neighboring region.
1546 // Not ideal, but until we know we're TP-ing from a neighboring region, there's not much we can do
1547 if (m_teleportFlags > 0) 1576 if (m_teleportFlags > 0)
1548 SendInitialDataToMe(); 1577 SendInitialDataToMe();
1549 1578
@@ -1600,10 +1629,6 @@ namespace OpenSim.Region.Framework.Scenes
1600// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1629// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1601// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1630// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1602 1631
1603 // DIVA NOTE: moved this here from MakeRoot. We don't want modules making heavy
1604 // computations before CompleteMovement is over
1605 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1606
1607 } 1632 }
1608 1633
1609 /// <summary> 1634 /// <summary>