minor: On teleport, signal a child agent before we send the viewer TeleportFinish in order to avoid a theoretical race condition when teleporting to a neighbour.

If we do this after TeleportFinish, then it's possible for a neighbour destination to request the source to create a child agent whilst its still treated as root.
This closes the original presence which we don't really want to do.
This is probably okay (albeit with warnings on the console) but afaics there's no reason not to move the child agent signal.
user_profiles
Justin Clark-Casey (justincc) 2013-03-21 23:37:23 +00:00
parent 46c833810c
commit e23a0dcc5d
1 changed files with 5 additions and 5 deletions

View File

@ -686,6 +686,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} from {1} to {2}",
capsPath, sp.Scene.RegionInfo.RegionName, sp.Name);
// We need to set this here to avoid an unlikely race condition when teleporting to a neighbour simulator,
// where that neighbour simulator could otherwise request a child agent create on the source which then
// closes our existing agent which is still signalled as root.
sp.IsChildAgent = true;
if (m_eqModule != null)
{
m_eqModule.TeleportFinishEvent(destinationHandle, 13, endPoint, 0, teleportFlags, capsPath, sp.UUID);
@ -696,9 +701,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
teleportFlags, capsPath);
}
// Let's set this to true tentatively. This does not trigger OnChildAgent
sp.IsChildAgent = true;
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
// trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
// that the client contacted the destination before we close things here.
@ -731,8 +733,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Now let's make it officially a child agent
sp.MakeChildAgent();
// sp.Scene.CleanDroppedAttachments();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))