public override void Close()
{
m_log.InfoFormat("[SCENE]: Closing down the single simulator: {0}", RegionInfo.RegionName);
m_restartTimer.Stop();
m_restartTimer.Close();
// Kick all ROOT agents with the message, 'The simulator is going down'
ForEachScenePresence(delegate(ScenePresence avatar)
{
if (avatar.KnownChildRegionHandles.Contains(RegionInfo.RegionHandle))
avatar.KnownChildRegionHandles.Remove(RegionInfo.RegionHandle);
if (!avatar.IsChildAgent)
avatar.ControllingClient.Kick("The simulator is going down.");
avatar.ControllingClient.SendShutdownConnectionNotice();
});
// Wait here, or the kick messages won't actually get to the agents before the scene terminates.
Thread.Sleep(500);
// Stop all client threads.
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
// Stop updating the scene objects and agents.
//m_heartbeatTimer.Close();
shuttingdown = true;
m_log.Debug("[SCENE]: Persisting changed objects");
EntityBase[] entities = GetEntities();
foreach (EntityBase entity in entities)
{
if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
{
((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false);
}
}
m_sceneGraph.Close();
// De-register with region communications (events cleanup)
UnRegisterRegionWithComms();
// call the base class Close method.
base.Close();
}