aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorDiva Canto2010-08-15 18:10:54 -0700
committerDiva Canto2010-08-15 18:10:54 -0700
commit5d29c0ec9d917c9edd251f8bf171c44e6922c4cf (patch)
tree165891c5584b4d02eed999036dbf8e58f7df4b49 /OpenSim/Region/CoreModules
parentFix SQLite database plugin for UserAccountData queries with a single word. (diff)
downloadopensim-SC_OLD-5d29c0ec9d917c9edd251f8bf171c44e6922c4cf.zip
opensim-SC_OLD-5d29c0ec9d917c9edd251f8bf171c44e6922c4cf.tar.gz
opensim-SC_OLD-5d29c0ec9d917c9edd251f8bf171c44e6922c4cf.tar.bz2
opensim-SC_OLD-5d29c0ec9d917c9edd251f8bf171c44e6922c4cf.tar.xz
Addresses mantis #4929. Agent was being logged off the grid too soon -- things may still fail.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs14
2 files changed, 23 insertions, 6 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 364d340..607219e 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -307,7 +307,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
307 string reason = String.Empty; 307 string reason = String.Empty;
308 308
309 // Let's create an agent there if one doesn't exist yet. 309 // Let's create an agent there if one doesn't exist yet.
310 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason)) 310 bool logout = false;
311 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
311 { 312 {
312 sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", 313 sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
313 reason)); 314 reason));
@@ -434,8 +435,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
434 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 435 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
435 CrossAttachmentsIntoNewRegion(finalDestination, sp, true); 436 CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
436 437
438 // Well, this is it. The agent is over there.
439
437 KillEntity(sp.Scene, sp.LocalId); 440 KillEntity(sp.Scene, sp.LocalId);
438 441
442 // May need to logout or other cleanup
443 AgentHasMovedAway(sp.ControllingClient.SessionId, logout);
444
439 // Now let's make it officially a child agent 445 // Now let's make it officially a child agent
440 sp.MakeChildAgent(); 446 sp.MakeChildAgent();
441 447
@@ -483,8 +489,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
483 489
484 } 490 }
485 491
486 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) 492 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
487 { 493 {
494 logout = false;
488 return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); 495 return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
489 } 496 }
490 497
@@ -500,6 +507,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
500 507
501 } 508 }
502 509
510 protected virtual void AgentHasMovedAway(UUID sessionID, bool logout)
511 {
512 }
513
503 protected void KillEntity(Scene scene, uint localID) 514 protected void KillEntity(Scene scene, uint localID)
504 { 515 {
505 scene.SendKillObject(localID); 516 scene.SendKillObject(localID);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 7d26e3f..d49d18d 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -140,9 +140,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
140 return false; 140 return false;
141 } 141 }
142 142
143 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) 143 protected override void AgentHasMovedAway(UUID sessionID, bool logout)
144 {
145 if (logout)
146 // Log them out of this grid
147 m_aScene.PresenceService.LogoutAgent(sessionID);
148 }
149
150 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
144 { 151 {
145 reason = string.Empty; 152 reason = string.Empty;
153 logout = false;
146 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); 154 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
147 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) 155 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0)
148 { 156 {
@@ -152,9 +160,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
152 string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString(); 160 string userAgentDriver = agentCircuit.ServiceURLs["HomeURI"].ToString();
153 IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver); 161 IUserAgentService connector = new UserAgentServiceConnector(userAgentDriver);
154 bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason); 162 bool success = connector.LoginAgentToGrid(agentCircuit, reg, finalDestination, out reason);
155 if (success) 163 logout = success;
156 // Log them out of this grid
157 m_aScene.PresenceService.LogoutAgent(agentCircuit.SessionID);
158 164
159 return success; 165 return success;
160 } 166 }