diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index db587382da..2bc8dcd2fb 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -86,7 +86,9 @@ namespace OpenSim.Framework.Communications.Cache } } - m_log.ErrorFormat("[USER CACHE]: Tried to remove the profile of user {0}, but this was not in the scene", userId); + m_log.WarnFormat( + "[USER CACHE]: Tried to remove the profile of user {0}, but this was not in the scene", userId); + return false; } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 2d0215f24f..b143f3e531 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -454,17 +454,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public void Close(bool shutdownCircuit) { - // Pull Client out of Region - m_log.Info("[CLIENT]: Close has been called"); + m_log.DebugFormat( + "[CLIENT]: Close has been called with shutdownCircuit = {0} on scene {1}", + shutdownCircuit, m_scene.RegionInfo.RegionName); + m_PacketHandler.Flush(); - //raiseevent on the packet server to Shutdown the circuit + // raise an event on the packet server to Shutdown the circuit + // Now, if we raise the event then the packet server will call this method itself, so don't try cleanup + // here otherwise we'll end up calling it twice. + // FIXME: In truth, I might be wrong but this whole business of calling this method twice (with different args) looks + // horribly tangly. Hopefully it should be possible to greatly simplify it. if (shutdownCircuit) { OnConnectionClosed(this); } - - CloseCleanup(shutdownCircuit); + else + { + CloseCleanup(shutdownCircuit); + } } public void Kick(string message) diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index c4e4919a37..cdc05ee01d 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -584,26 +584,26 @@ namespace OpenSim.Region.Environment.Scenes { lock (Entities) { - if (Entities.Remove(agentID)) - { - //m_log.InfoFormat("[SCENE] Removed scene presence {0} from entities list", agentID); - } - else + if (!Entities.Remove(agentID)) { m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", agentID); } +// else +// { +// m_log.InfoFormat("[SCENE] Removed scene presence {0} from entities list", agentID); +// } } lock (ScenePresences) { - if (ScenePresences.Remove(agentID)) + if (!ScenePresences.Remove(agentID)) { - //m_log.InfoFormat("[SCENE] Removed scene presence {0}", agentID); - } - else - { - m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); + m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); } +// else +// { +// m_log.InfoFormat("[SCENE] Removed scene presence {0} from scene presences list", agentID); +// } } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index b54713f839..ef0a119130 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2259,6 +2259,7 @@ namespace OpenSim.Region.Environment.Scenes { childagentYN = avatar.IsChildAgent; } + try { m_log.DebugFormat( @@ -2295,6 +2296,7 @@ namespace OpenSim.Region.Environment.Scenes // We don't know which count to remove it from // Avatar is already disposed :/ } + m_eventManager.TriggerOnRemovePresence(agentID); Broadcast(delegate(IClientAPI client) { @@ -2631,6 +2633,7 @@ namespace OpenSim.Region.Environment.Scenes { m_innerScene.removeUserCount(true); } + // Tell a single agent to disconnect from the region. presence.ControllingClient.SendShutdownConnectionNotice();