diff options
author | Melanie | 2012-07-16 23:33:33 +0100 |
---|---|---|
committer | Melanie | 2012-07-16 23:33:33 +0100 |
commit | 2a85372169fd340b0efbf45ab865d391a8963e00 (patch) | |
tree | 6c1de522b64ea4bec3bd6fd236d54c0cfdf2e700 | |
parent | Revert "Fix script "Running" behavior" (diff) | |
parent | refactor: factor out common code in WebStatsModule.OnMakeRootAgent() (diff) | |
download | opensim-SC-2a85372169fd340b0efbf45ab865d391a8963e00.zip opensim-SC-2a85372169fd340b0efbf45ab865d391a8963e00.tar.gz opensim-SC-2a85372169fd340b0efbf45ab865d391a8963e00.tar.bz2 opensim-SC-2a85372169fd340b0efbf45ab865d391a8963e00.tar.xz |
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/UserStatistics/WebStatsModule.cs | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index faf746f..c11ea02 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs | |||
@@ -57,7 +57,12 @@ namespace OpenSim.Region.UserStatistics | |||
57 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 57 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
58 | 58 | ||
59 | private static SqliteConnection dbConn; | 59 | private static SqliteConnection dbConn; |
60 | |||
61 | /// <summary> | ||
62 | /// User statistics sessions keyed by agent ID | ||
63 | /// </summary> | ||
60 | private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>(); | 64 | private Dictionary<UUID, UserSessionID> m_sessions = new Dictionary<UUID, UserSessionID>(); |
65 | |||
61 | private List<Scene> m_scenes = new List<Scene>(); | 66 | private List<Scene> m_scenes = new List<Scene>(); |
62 | private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>(); | 67 | private Dictionary<string, IStatsController> reports = new Dictionary<string, IStatsController>(); |
63 | private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>(); | 68 | private Dictionary<UUID, USimStatsData> m_simstatsCounters = new Dictionary<UUID, USimStatsData>(); |
@@ -308,49 +313,41 @@ namespace OpenSim.Region.UserStatistics | |||
308 | scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps; | 313 | scene.EventManager.OnDeregisterCaps += OnDeRegisterCaps; |
309 | scene.EventManager.OnClientClosed += OnClientClosed; | 314 | scene.EventManager.OnClientClosed += OnClientClosed; |
310 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; | 315 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; |
311 | scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; | ||
312 | } | 316 | } |
313 | } | 317 | } |
314 | } | 318 | } |
315 | 319 | ||
316 | private void OnMakeRootAgent(ScenePresence agent) | 320 | private void OnMakeRootAgent(ScenePresence agent) |
317 | { | 321 | { |
318 | UUID regionUUID = GetRegionUUIDFromHandle(agent.RegionHandle); | ||
319 | |||
320 | lock (m_sessions) | 322 | lock (m_sessions) |
321 | { | 323 | { |
324 | UserSessionID uid; | ||
325 | |||
322 | if (!m_sessions.ContainsKey(agent.UUID)) | 326 | if (!m_sessions.ContainsKey(agent.UUID)) |
323 | { | 327 | { |
324 | UserSessionData usd = UserSessionUtil.newUserSessionData(); | 328 | UserSessionData usd = UserSessionUtil.newUserSessionData(); |
325 | 329 | uid = new UserSessionID(); | |
326 | UserSessionID uid = new UserSessionID(); | ||
327 | uid.name_f = agent.Firstname; | 330 | uid.name_f = agent.Firstname; |
328 | uid.name_l = agent.Lastname; | 331 | uid.name_l = agent.Lastname; |
329 | uid.region_id = regionUUID; | ||
330 | uid.session_id = agent.ControllingClient.SessionId; | ||
331 | uid.session_data = usd; | 332 | uid.session_data = usd; |
332 | 333 | ||
333 | m_sessions.Add(agent.UUID, uid); | 334 | m_sessions.Add(agent.UUID, uid); |
334 | } | 335 | } |
335 | else | 336 | else |
336 | { | 337 | { |
337 | UserSessionID uid = m_sessions[agent.UUID]; | 338 | uid = m_sessions[agent.UUID]; |
338 | uid.region_id = regionUUID; | ||
339 | uid.session_id = agent.ControllingClient.SessionId; | ||
340 | m_sessions[agent.UUID] = uid; | ||
341 | } | 339 | } |
342 | } | ||
343 | } | ||
344 | 340 | ||
345 | private void OnMakeChildAgent(ScenePresence agent) | 341 | uid.region_id = agent.Scene.RegionInfo.RegionID; |
346 | { | 342 | uid.session_id = agent.ControllingClient.SessionId; |
343 | } | ||
347 | } | 344 | } |
348 | 345 | ||
349 | private void OnClientClosed(UUID agentID, Scene scene) | 346 | private void OnClientClosed(UUID agentID, Scene scene) |
350 | { | 347 | { |
351 | lock (m_sessions) | 348 | lock (m_sessions) |
352 | { | 349 | { |
353 | if (m_sessions.ContainsKey(agentID)) | 350 | if (m_sessions.ContainsKey(agentID) && m_sessions[agentID].region_id == scene.RegionInfo.RegionID) |
354 | { | 351 | { |
355 | m_sessions.Remove(agentID); | 352 | m_sessions.Remove(agentID); |
356 | } | 353 | } |
@@ -395,20 +392,6 @@ namespace OpenSim.Region.UserStatistics | |||
395 | return encoding.GetString(buffer); | 392 | return encoding.GetString(buffer); |
396 | } | 393 | } |
397 | 394 | ||
398 | private UUID GetRegionUUIDFromHandle(ulong regionhandle) | ||
399 | { | ||
400 | lock (m_scenes) | ||
401 | { | ||
402 | foreach (Scene scene in m_scenes) | ||
403 | { | ||
404 | if (scene.RegionInfo.RegionHandle == regionhandle) | ||
405 | return scene.RegionInfo.RegionID; | ||
406 | } | ||
407 | } | ||
408 | |||
409 | return UUID.Zero; | ||
410 | } | ||
411 | |||
412 | /// <summary> | 395 | /// <summary> |
413 | /// Callback for a viewerstats cap | 396 | /// Callback for a viewerstats cap |
414 | /// </summary> | 397 | /// </summary> |