aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs1
4 files changed, 72 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 54956ee..9cfe869 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3452,7 +3452,7 @@ namespace OpenSim.Region.Framework.Scenes
3452 regions.Remove(RegionInfo.RegionHandle); 3452 regions.Remove(RegionInfo.RegionHandle);
3453 3453
3454 // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. 3454 // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours.
3455 m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); 3455 m_sceneGridService.SendCloseChildAgentConnections(agentID, acd.SessionID.ToString(), regions);
3456 } 3456 }
3457 3457
3458 m_eventManager.TriggerClientClosed(agentID, this); 3458 m_eventManager.TriggerClientClosed(agentID, this);
@@ -4202,10 +4202,16 @@ namespace OpenSim.Region.Framework.Scenes
4202 4202
4203 if (childAgentUpdate != null) 4203 if (childAgentUpdate != null)
4204 { 4204 {
4205 if (cAgentData.SessionID != childAgentUpdate.ControllingClient.SessionId)
4206 {
4207 m_log.WarnFormat("[SCENE]: Attempt to update agent {0} with invalid session id {1} (possibly from simulator in older version; tell them to update).", childAgentUpdate.UUID, cAgentData.SessionID);
4208 Console.WriteLine(String.Format("[SCENE]: Attempt to update agent {0} ({1}) with invalid session id {2}",
4209 childAgentUpdate.UUID, childAgentUpdate.ControllingClient.SessionId, cAgentData.SessionID));
4210 }
4211
4205 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 4212 childAgentUpdate.ChildAgentDataUpdate(cAgentData);
4206 return true; 4213 return true;
4207 } 4214 }
4208
4209 return false; 4215 return false;
4210 } 4216 }
4211 4217
@@ -4221,20 +4227,24 @@ namespace OpenSim.Region.Framework.Scenes
4221 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 4227 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
4222 if (childAgentUpdate != null) 4228 if (childAgentUpdate != null)
4223 { 4229 {
4224 // I can't imagine *yet* why we would get an update if the agent is a root agent.. 4230 if (childAgentUpdate.ControllingClient.SessionId == cAgentData.SessionID)
4225 // however to avoid a race condition crossing borders..
4226 if (childAgentUpdate.IsChildAgent)
4227 { 4231 {
4228 uint rRegionX = (uint)(cAgentData.RegionHandle >> 40); 4232 // I can't imagine *yet* why we would get an update if the agent is a root agent..
4229 uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8); 4233 // however to avoid a race condition crossing borders..
4230 uint tRegionX = RegionInfo.RegionLocX; 4234 if (childAgentUpdate.IsChildAgent)
4231 uint tRegionY = RegionInfo.RegionLocY; 4235 {
4232 //Send Data to ScenePresence 4236 uint rRegionX = (uint)(cAgentData.RegionHandle >> 40);
4233 childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY); 4237 uint rRegionY = (((uint)(cAgentData.RegionHandle)) >> 8);
4234 // Not Implemented: 4238 uint tRegionX = RegionInfo.RegionLocX;
4235 //TODO: Do we need to pass the message on to one of our neighbors? 4239 uint tRegionY = RegionInfo.RegionLocY;
4240 //Send Data to ScenePresence
4241 childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY);
4242 // Not Implemented:
4243 //TODO: Do we need to pass the message on to one of our neighbors?
4244 }
4236 } 4245 }
4237 4246 else
4247 m_log.WarnFormat("[SCENE]: Attempt at updating position of agent {0} with invalid session id {1}", childAgentUpdate.UUID, cAgentData.SessionID);
4238 return true; 4248 return true;
4239 } 4249 }
4240 4250
@@ -4277,6 +4287,25 @@ namespace OpenSim.Region.Framework.Scenes
4277 4287
4278 return false; 4288 return false;
4279 } 4289 }
4290 /// <summary>
4291 /// Authenticated close (via network)
4292 /// </summary>
4293 /// <param name="agentID"></param>
4294 /// <param name="force"></param>
4295 /// <param name="auth_token"></param>
4296 /// <returns></returns>
4297 public bool IncomingCloseAgent(UUID agentID, bool force, string auth_token)
4298 {
4299 //m_log.DebugFormat("[SCENE]: Processing incoming close agent {0} in region {1} with auth_token {2}", agentID, RegionInfo.RegionName, auth_token);
4300
4301 // Check that the auth_token is valid
4302 AgentCircuitData acd = AuthenticateHandler.GetAgentCircuitData(agentID);
4303 if (acd != null && acd.SessionID.ToString() == auth_token)
4304 return IncomingCloseAgent(agentID, force);
4305 else
4306 m_log.ErrorFormat("[SCENE]: Request to close agent {0} with invalid authorization token {1}", agentID, auth_token);
4307 return false;
4308 }
4280 4309
4281 /// <summary> 4310 /// <summary>
4282 /// Tell a single agent to disconnect from the region. 4311 /// Tell a single agent to disconnect from the region.
@@ -4289,7 +4318,6 @@ namespace OpenSim.Region.Framework.Scenes
4289 public bool IncomingCloseAgent(UUID agentID, bool force) 4318 public bool IncomingCloseAgent(UUID agentID, bool force)
4290 { 4319 {
4291 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); 4320 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
4292
4293 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); 4321 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
4294 if (presence != null) 4322 if (presence != null)
4295 { 4323 {
@@ -4297,7 +4325,7 @@ namespace OpenSim.Region.Framework.Scenes
4297 return true; 4325 return true;
4298 } 4326 }
4299 4327
4300 // Agent not here 4328 // Agent not here
4301 return false; 4329 return false;
4302 } 4330 }
4303 4331
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 8238e23..77889fa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -197,7 +197,7 @@ namespace OpenSim.Region.Framework.Scenes
197 /// <summary> 197 /// <summary>
198 /// Closes a child agent on a given region 198 /// Closes a child agent on a given region
199 /// </summary> 199 /// </summary>
200 protected void SendCloseChildAgent(UUID agentID, ulong regionHandle) 200 protected void SendCloseChildAgent(UUID agentID, ulong regionHandle, string auth_token)
201 { 201 {
202 // let's do our best, but there's not much we can do if the neighbour doesn't accept. 202 // let's do our best, but there's not much we can do if the neighbour doesn't accept.
203 203
@@ -210,7 +210,7 @@ namespace OpenSim.Region.Framework.Scenes
210 m_log.DebugFormat( 210 m_log.DebugFormat(
211 "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName); 211 "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName);
212 212
213 m_scene.SimulationService.CloseAgent(destination, agentID); 213 m_scene.SimulationService.CloseAgent(destination, agentID, auth_token);
214 } 214 }
215 215
216 /// <summary> 216 /// <summary>
@@ -219,14 +219,14 @@ namespace OpenSim.Region.Framework.Scenes
219 /// </summary> 219 /// </summary>
220 /// <param name="agentID"></param> 220 /// <param name="agentID"></param>
221 /// <param name="regionslst"></param> 221 /// <param name="regionslst"></param>
222 public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst) 222 public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List<ulong> regionslst)
223 { 223 {
224 foreach (ulong handle in regionslst) 224 foreach (ulong handle in regionslst)
225 { 225 {
226 // We must take a copy here since handle is acts like a reference when used in an iterator. 226 // We must take a copy here since handle is acts like a reference when used in an iterator.
227 // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region. 227 // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region.
228 ulong handleCopy = handle; 228 ulong handleCopy = handle;
229 Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy); }); 229 Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy, auth_code); });
230 } 230 }
231 } 231 }
232 232
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 774546c..990ef6e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1010,7 +1010,9 @@ namespace OpenSim.Region.Framework.Scenes
1010 // recorded, which stops the input from being processed. 1010 // recorded, which stops the input from being processed.
1011 MovementFlag = 0; 1011 MovementFlag = 0;
1012 1012
1013 m_scene.EventManager.TriggerOnMakeRootAgent(this); 1013 // DIVA NOTE: I moved TriggerOnMakeRootAgent out of here and into the end of
1014 // CompleteMovement. We don't want modules doing heavy computation before CompleteMovement
1015 // is over.
1014 } 1016 }
1015 1017
1016 public int GetStateSource() 1018 public int GetStateSource()
@@ -1327,10 +1329,15 @@ namespace OpenSim.Region.Framework.Scenes
1327 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1329 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1328 MakeRootAgent(AbsolutePosition, flying); 1330 MakeRootAgent(AbsolutePosition, flying);
1329 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1331 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1332 // Remember in HandleUseCircuitCode, we delayed this to here
1333 // This will also send the initial data to clients when TP to a neighboring region.
1334 // Not ideal, but until we know we're TP-ing from a neighboring region, there's not much we can do
1335 if (m_teleportFlags > 0)
1336 SendInitialDataToMe();
1330 1337
1331// m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); 1338// m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1332 1339
1333 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1340 if (!string.IsNullOrEmpty(m_callbackURI))
1334 { 1341 {
1335 // We cannot sleep here since this would hold up the inbound packet processing thread, as 1342 // We cannot sleep here since this would hold up the inbound packet processing thread, as
1336 // CompleteMovement() is executed synchronously. However, it might be better to delay the release 1343 // CompleteMovement() is executed synchronously. However, it might be better to delay the release
@@ -1358,9 +1365,6 @@ namespace OpenSim.Region.Framework.Scenes
1358 // Create child agents in neighbouring regions 1365 // Create child agents in neighbouring regions
1359 if (openChildAgents && !IsChildAgent) 1366 if (openChildAgents && !IsChildAgent)
1360 { 1367 {
1361 // Remember in HandleUseCircuitCode, we delayed this to here
1362 SendInitialDataToMe();
1363
1364 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); 1368 IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
1365 if (m_agentTransfer != null) 1369 if (m_agentTransfer != null)
1366 Util.FireAndForget(delegate { m_agentTransfer.EnableChildAgents(this); }); 1370 Util.FireAndForget(delegate { m_agentTransfer.EnableChildAgents(this); });
@@ -1382,6 +1386,11 @@ namespace OpenSim.Region.Framework.Scenes
1382// m_log.DebugFormat( 1386// m_log.DebugFormat(
1383// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1387// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1384// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1388// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1389
1390 // DIVA NOTE: moved this here from MakeRoot. We don't want modules making heavy
1391 // computations before CompleteMovement is over
1392 m_scene.EventManager.TriggerOnMakeRootAgent(this);
1393
1385 } 1394 }
1386 1395
1387 /// <summary> 1396 /// <summary>
@@ -2689,11 +2698,12 @@ namespace OpenSim.Region.Framework.Scenes
2689 SendOtherAgentsAppearanceToMe(); 2698 SendOtherAgentsAppearanceToMe();
2690 2699
2691 EntityBase[] entities = Scene.Entities.GetEntities(); 2700 EntityBase[] entities = Scene.Entities.GetEntities();
2692 foreach(EntityBase e in entities) 2701 foreach (EntityBase e in entities)
2693 { 2702 {
2694 if (e != null && e is SceneObjectGroup) 2703 if (e != null && e is SceneObjectGroup)
2695 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); 2704 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient);
2696 } 2705 }
2706
2697 }); 2707 });
2698 } 2708 }
2699 2709
@@ -2917,7 +2927,7 @@ namespace OpenSim.Region.Framework.Scenes
2917 cadu.Velocity = Velocity; 2927 cadu.Velocity = Velocity;
2918 2928
2919 AgentPosition agentpos = new AgentPosition(); 2929 AgentPosition agentpos = new AgentPosition();
2920 agentpos.CopyFrom(cadu); 2930 agentpos.CopyFrom(cadu, ControllingClient.SessionId);
2921 2931
2922 // Let's get this out of the update loop 2932 // Let's get this out of the update loop
2923 Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); }); 2933 Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); });
@@ -3155,7 +3165,11 @@ namespace OpenSim.Region.Framework.Scenes
3155 { 3165 {
3156 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); 3166 m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents");
3157 3167
3158 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); 3168 AgentCircuitData acd = Scene.AuthenticateHandler.GetAgentCircuitData(UUID);
3169 string auth = string.Empty;
3170 if (acd != null)
3171 auth = acd.SessionID.ToString();
3172 m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, auth, byebyeRegions);
3159 } 3173 }
3160 3174
3161 foreach (ulong handle in byebyeRegions) 3175 foreach (ulong handle in byebyeRegions)
@@ -3252,6 +3266,7 @@ namespace OpenSim.Region.Framework.Scenes
3252 3266
3253 cAgent.AgentID = UUID; 3267 cAgent.AgentID = UUID;
3254 cAgent.RegionID = Scene.RegionInfo.RegionID; 3268 cAgent.RegionID = Scene.RegionInfo.RegionID;
3269 cAgent.SessionID = ControllingClient.SessionId;
3255 3270
3256 cAgent.Position = AbsolutePosition; 3271 cAgent.Position = AbsolutePosition;
3257 cAgent.Velocity = m_velocity; 3272 cAgent.Velocity = m_velocity;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
index 5a72239..5df9aba 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -112,6 +112,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
112 //moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero); 112 //moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero);
113 moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2))); 113 moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2)));
114 moveArgs.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS; 114 moveArgs.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
115 moveArgs.SessionID = acd.SessionID;
115 116
116 originalSp.HandleAgentUpdate(originalSp.ControllingClient, moveArgs); 117 originalSp.HandleAgentUpdate(originalSp.ControllingClient, moveArgs);
117 118