aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs5
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs24
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs24
-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
12 files changed, 109 insertions, 95 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
index 86a0298..164adeb 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs
@@ -347,8 +347,9 @@ namespace OpenSim.Region.ClientStack.Linden
347 347
348 aPollRequest poolreq = m_queue.Dequeue(); 348 aPollRequest poolreq = m_queue.Dequeue();
349 349
350 poolreq.thepoll.Process(poolreq); 350 if (poolreq != null && poolreq.thepoll != null)
351 poolreq.thepoll.Process(poolreq);
351 } 352 }
352 } 353 }
353 } 354 }
354} \ No newline at end of file 355}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
index 2aab4f9..85270a6 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -1469,7 +1469,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1469 { 1469 {
1470 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); 1470 AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
1471 bool tp = (aCircuit.teleportFlags > 0); 1471 bool tp = (aCircuit.teleportFlags > 0);
1472 // Let's delay this for TP agents, otherwise the viewer doesn't know where to get meshes from 1472 // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from
1473 if (!tp) 1473 if (!tp)
1474 client.SceneAgent.SendInitialDataToMe(); 1474 client.SceneAgent.SendInitialDataToMe();
1475 } 1475 }
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 85d26f3..344c8d7 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -817,7 +817,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
817 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.", 817 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.",
818 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); 818 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName);
819 819
820 Fail(sp, finalDestination, logout, "Connection between viewer and destination region could not be established."); 820 Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established.");
821 return; 821 return;
822 } 822 }
823 823
@@ -829,7 +829,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
829 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request", 829 "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request",
830 sp.Name, finalDestination.RegionName, sp.Scene.Name); 830 sp.Name, finalDestination.RegionName, sp.Scene.Name);
831 831
832 CleanupFailedInterRegionTeleport(sp, finalDestination); 832 CleanupFailedInterRegionTeleport(sp, currentAgentCircuit.SessionID.ToString(), finalDestination);
833 833
834 return; 834 return;
835 } 835 }
@@ -873,7 +873,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
873 "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", 873 "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.",
874 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); 874 sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName);
875 875
876 Fail(sp, finalDestination, logout, "Destination region did not signal teleport completion."); 876 Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Destination region did not signal teleport completion.");
877 877
878 return; 878 return;
879 } 879 }
@@ -927,7 +927,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
927 /// <remarks> 927 /// <remarks>
928 /// <param name='sp'> </param> 928 /// <param name='sp'> </param>
929 /// <param name='finalDestination'></param> 929 /// <param name='finalDestination'></param>
930 protected virtual void CleanupFailedInterRegionTeleport(ScenePresence sp, GridRegion finalDestination) 930 protected virtual void CleanupFailedInterRegionTeleport(ScenePresence sp, string auth_token, GridRegion finalDestination)
931 { 931 {
932 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); 932 m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
933 933
@@ -938,7 +938,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
938 938
939 // Finally, kill the agent we just created at the destination. 939 // Finally, kill the agent we just created at the destination.
940 // XXX: Possibly this should be done asynchronously. 940 // XXX: Possibly this should be done asynchronously.
941 Scene.SimulationService.CloseAgent(finalDestination, sp.UUID); 941 Scene.SimulationService.CloseAgent(finalDestination, sp.UUID, auth_token);
942 } 942 }
943 943
944 /// <summary> 944 /// <summary>
@@ -948,9 +948,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
948 /// <param name='finalDestination'></param> 948 /// <param name='finalDestination'></param>
949 /// <param name='logout'></param> 949 /// <param name='logout'></param>
950 /// <param name='reason'>Human readable reason for teleport failure. Will be sent to client.</param> 950 /// <param name='reason'>Human readable reason for teleport failure. Will be sent to client.</param>
951 protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout, string reason) 951 protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout, string auth_code, string reason)
952 { 952 {
953 CleanupFailedInterRegionTeleport(sp, finalDestination); 953 CleanupFailedInterRegionTeleport(sp, auth_code, finalDestination);
954 954
955 m_interRegionTeleportFailures.Value++; 955 m_interRegionTeleportFailures.Value++;
956 956
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 759155a..76dbc72 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -207,6 +207,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
207 { 207 {
208 m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService); 208 m_GatekeeperConnector = new GatekeeperServiceConnector(scene.AssetService);
209 m_UAS = scene.RequestModuleInterface<IUserAgentService>(); 209 m_UAS = scene.RequestModuleInterface<IUserAgentService>();
210 if (m_UAS == null)
211 m_UAS = new UserAgentServiceConnector(m_ThisHomeURI);
212
210 } 213 }
211 } 214 }
212 215
@@ -573,12 +576,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
573 if (uMan != null && uMan.IsLocalGridUser(obj.AgentId)) 576 if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
574 { 577 {
575 // local grid user 578 // local grid user
579 m_UAS.LogoutAgent(obj.AgentId, obj.SessionId);
576 return; 580 return;
577 } 581 }
578 582
579 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode); 583 AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);
580 584 if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("HomeURI"))
581 if (aCircuit.ServiceURLs.ContainsKey("HomeURI"))
582 { 585 {
583 string url = aCircuit.ServiceURLs["HomeURI"].ToString(); 586 string url = aCircuit.ServiceURLs["HomeURI"].ToString();
584 IUserAgentService security = new UserAgentServiceConnector(url); 587 IUserAgentService security = new UserAgentServiceConnector(url);
diff --git a/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs b/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs
index f1eb1ad..fd4d48a 100644
--- a/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/GridServiceThrottle/GridServiceThrottleModule.cs
@@ -140,11 +140,13 @@ namespace OpenSim.Region.CoreModules.Framework
140 Watchdog.UpdateThread(); 140 Watchdog.UpdateThread();
141 141
142 GridRegionRequest request = m_RequestQueue.Dequeue(); 142 GridRegionRequest request = m_RequestQueue.Dequeue();
143 GridRegion r = m_scenes[0].GridService.GetRegionByUUID(UUID.Zero, request.regionID); 143 if (request != null)
144 144 {
145 if (r != null && r.RegionHandle != 0) 145 GridRegion r = m_scenes[0].GridService.GetRegionByUUID(UUID.Zero, request.regionID);
146 request.client.SendRegionHandle(request.regionID, r.RegionHandle);
147 146
147 if (r != null && r.RegionHandle != 0)
148 request.client.SendRegionHandle(request.regionID, r.RegionHandle);
149 }
148 } 150 }
149 } 151 }
150 } 152 }
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index a528093..507329e 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -681,17 +681,19 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
681 Watchdog.UpdateThread(); 681 Watchdog.UpdateThread();
682 682
683 NameRequest request = m_RequestQueue.Dequeue(); 683 NameRequest request = m_RequestQueue.Dequeue();
684 string[] names; 684 if (request != null)
685 bool foundRealName = TryGetUserNames(request.uuid, out names);
686
687 if (names.Length == 2)
688 { 685 {
689 if (!foundRealName) 686 string[] names;
690 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], request.uuid, request.client.Name); 687 bool foundRealName = TryGetUserNames(request.uuid, out names);
691 688
692 request.client.SendNameReply(request.uuid, names[0], names[1]); 689 if (names.Length == 2)
693 } 690 {
691 if (!foundRealName)
692 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], request.uuid, request.client.Name);
694 693
694 request.client.SendNameReply(request.uuid, names[0], names[1]);
695 }
696 }
695 } 697 }
696 } 698 }
697 699
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 9427961..6d5039b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -250,26 +250,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
250 return true; 250 return true;
251 } 251 }
252 252
253 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
254 {
255 agent = null;
256
257 if (destination == null)
258 return false;
259
260 if (m_scenes.ContainsKey(destination.RegionID))
261 {
262// m_log.DebugFormat(
263// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
264// s.RegionInfo.RegionName, destination.RegionHandle);
265
266 return m_scenes[destination.RegionID].IncomingRetrieveRootAgent(id, out agent);
267 }
268
269 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
270 return false;
271 }
272
273 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) 253 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
274 { 254 {
275 reason = "Communications failure"; 255 reason = "Communications failure";
@@ -306,7 +286,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
306 return false; 286 return false;
307 } 287 }
308 288
309 public bool CloseAgent(GridRegion destination, UUID id) 289 public bool CloseAgent(GridRegion destination, UUID id, string auth_token)
310 { 290 {
311 if (destination == null) 291 if (destination == null)
312 return false; 292 return false;
@@ -317,7 +297,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
317// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 297// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
318// s.RegionInfo.RegionName, destination.RegionHandle); 298// s.RegionInfo.RegionName, destination.RegionHandle);
319 299
320 m_scenes[destination.RegionID].IncomingCloseAgent(id, false); 300 m_scenes[destination.RegionID].IncomingCloseAgent(id, false, auth_token);
321 return true; 301 return true;
322 } 302 }
323 303
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index d120e11..8722b80 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -212,24 +212,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
212 return m_remoteConnector.UpdateAgent(destination, cAgentData); 212 return m_remoteConnector.UpdateAgent(destination, cAgentData);
213 } 213 }
214 214
215 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
216 {
217 agent = null;
218
219 if (destination == null)
220 return false;
221
222 // Try local first
223 if (m_localBackend.RetrieveAgent(destination, id, out agent))
224 return true;
225
226 // else do the remote thing
227 if (!m_localBackend.IsLocalRegion(destination.RegionID))
228 return m_remoteConnector.RetrieveAgent(destination, id, out agent);
229
230 return false;
231 }
232
233 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) 215 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
234 { 216 {
235 reason = "Communications failure"; 217 reason = "Communications failure";
@@ -263,18 +245,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
263 } 245 }
264 246
265 247
266 public bool CloseAgent(GridRegion destination, UUID id) 248 public bool CloseAgent(GridRegion destination, UUID id, string auth_token)
267 { 249 {
268 if (destination == null) 250 if (destination == null)
269 return false; 251 return false;
270 252
271 // Try local first 253 // Try local first
272 if (m_localBackend.CloseAgent(destination, id)) 254 if (m_localBackend.CloseAgent(destination, id, auth_token))
273 return true; 255 return true;
274 256
275 // else do the remote thing 257 // else do the remote thing
276 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 258 if (!m_localBackend.IsLocalRegion(destination.RegionID))
277 return m_remoteConnector.CloseAgent(destination, id); 259 return m_remoteConnector.CloseAgent(destination, id, auth_token);
278 260
279 return false; 261 return false;
280 } 262 }
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