From 8ab5f2ce849276dbc1fb92c288fb06fed1123f31 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 13 Sep 2014 16:39:56 +0200 Subject: [PATCH] When CloseAgnt is called with an agent id that doesn't have a presence, check for stray clients and clean them up instead of failing. --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d336eda822..55e7da450c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4743,6 +4743,18 @@ namespace OpenSim.Region.Framework.Scenes if (sp == null) { + // If there is no scene presence, we may be handling a dead + // client. These can keep an avatar from reentering a region + // and since they don't get cleaned up they will stick + // around until region restart. So, if there is no SP, + // remove the client as well. + IClientAPI client = null; + if (m_clientManager.TryGetValue(agentID, out client)) + { + m_clientManager.Remove(agentID); + m_log.DebugFormat( "[SCENE]: Dead client for agent ID {0} was cleaned up in {1}", agentID, Name); + return true; + } m_log.DebugFormat( "[SCENE]: Called CloseClient() with agent ID {0} but no such presence is in {1}", agentID, Name);