From 97d084c9f58b66a0ae8b86d9e5b29ecccae1589f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 16 Jul 2012 23:03:23 +0100 Subject: [PATCH] Stop warning about no session from ViewerStats if user teleports to another region in the same simulator that was not next to the source region. This was because teleporting to the new region invoked the new session setup code before the agent was removed from the old region, which then invoked the session teardown code. Now, we only invoke the teardown code if the region ID occupied by the agent being removed is the same as the one registered for the current session. --- OpenSim/Region/UserStatistics/WebStatsModule.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index faf746fac0..d1a7217e4a 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -57,7 +57,12 @@ namespace OpenSim.Region.UserStatistics LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static SqliteConnection dbConn; + + /// + /// User statistics sessions keyed by agent ID + /// private Dictionary m_sessions = new Dictionary(); + private List m_scenes = new List(); private Dictionary reports = new Dictionary(); private Dictionary m_simstatsCounters = new Dictionary(); @@ -308,7 +313,6 @@ namespace OpenSim.Region.UserStatistics scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps; scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; - scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; } } } @@ -342,15 +346,11 @@ namespace OpenSim.Region.UserStatistics } } - private void OnMakeChildAgent(ScenePresence agent) - { - } - private void OnClientClosed(UUID agentID, Scene scene) { lock (m_sessions) { - if (m_sessions.ContainsKey(agentID)) + if (m_sessions.ContainsKey(agentID) && m_sessions[agentID].region_id == scene.RegionInfo.RegionID) { m_sessions.Remove(agentID); }