Do not use the SP.DoNotCloseAfterTeleport flag for child agent connections.

This approach has problems if a client quits without sending a proper logout but then reconnects before the connection is closed due to inactivity.
In this case, the DoNotCloseAfterTeleport was wrongly set.
The simplest approach is to close child agents on teleport as quickly as possible so that races are very unlikely to occur
Hence, this code now closes child agents as the first action after a sucessful teleport.
This commit is contained in:
Justin Clark-Casey (justincc)
2013-08-15 13:46:46 +01:00
parent 5011c657b5
commit 2231fcf5b4
2 changed files with 33 additions and 24 deletions

View File

@@ -3703,21 +3703,30 @@ namespace OpenSim.Region.Framework.Scenes
// In the case where, for example, an A B C D region layout, an avatar may
// teleport from A -> D, but then -> C before A has asked B to close its old child agent. When C
// renews the lease on the child agent at B, we must make sure that the close from A does not succeed.
if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle))
{
m_log.DebugFormat(
"[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because source will attempt close.",
sp.Name, Name);
//
// XXX: In the end, this should not be necessary if child agents are closed without delay on
// teleport, since realistically, the close request should always be processed before any other
// region tried to re-establish a child agent. This is much simpler since the logic below is
// vulnerable to an issue when a viewer quits a region without sending a proper logout but then
// re-establishes the connection on a relogin. This could wrongly set the DoNotCloseAfterTeleport
// flag when no teleport had taken place (and hence no close was going to come).
// if (!acd.ChildrenCapSeeds.ContainsKey(RegionInfo.RegionHandle))
// {
// m_log.DebugFormat(
// "[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because source will attempt close.",
// sp.Name, Name);
//
// sp.DoNotCloseAfterTeleport = true;
// }
// else if (EntityTransferModule.IsInTransit(sp.UUID))
sp.DoNotCloseAfterTeleport = true;
}
else if (EntityTransferModule.IsInTransit(sp.UUID))
if (EntityTransferModule.IsInTransit(sp.UUID))
{
m_log.DebugFormat(
"[SCENE]: Setting DoNotCloseAfterTeleport for child scene presence {0} in {1} because this region will attempt previous end-of-teleport close.",
sp.Name, Name);
sp.DoNotCloseAfterTeleport = true;
m_log.DebugFormat(
"[SCENE]: Set DoNotCloseAfterTeleport for child scene presence {0} in {1} because this region will attempt previous end-of-teleport close.",
sp.Name, Name);
}
}
}