From 82b875317b7e3e5bc45cc91e022764f07af938ec Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 4 Jul 2014 14:36:11 -0700
Subject: On logout, delay the removal of AgentCircuitData until the very end,
 because that data structure contains important information about the agent
 that may be needed by modules.

---
 OpenSim/Region/Framework/Scenes/Scene.cs | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

(limited to 'OpenSim/Region/Framework')

diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 27042a3..27929c6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3219,10 +3219,6 @@ namespace OpenSim.Region.Framework.Scenes
 
                 return;
             }
-            else
-            {
-                m_authenticateHandler.RemoveCircuit(agentID);
-            }
 
             // TODO: Can we now remove this lock?
             lock (acd)
@@ -3238,7 +3234,8 @@ namespace OpenSim.Region.Framework.Scenes
                 {
                     m_log.ErrorFormat(
                         "[SCENE]: Called RemoveClient() with agent ID {0} but no such presence is in the scene.", agentID);
-    
+                    m_authenticateHandler.RemoveCircuit(agentID);
+
                     return;
                 }
 
@@ -3315,6 +3312,7 @@ namespace OpenSim.Region.Framework.Scenes
                         // Always clean these structures up so that any failure above doesn't cause them to remain in the
                         // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
                         // the same cleanup exception continually.
+                        m_authenticateHandler.RemoveCircuit(agentID);
                         m_sceneGraph.RemoveScenePresence(agentID);
                         m_clientManager.Remove(agentID);
         
-- 
cgit v1.1