From e9153e1d1aae50024d8cd05fe14a9bce34343a0e Mon Sep 17 00:00:00 2001
From: teravus
Date: Thu, 15 Nov 2012 10:05:16 -0500
Subject: Revert "Merge master into teravuswork", it should have been
avination, not master.
This reverts commit dfac269032300872c4d0dc507f4f9062d102b0f4, reversing
changes made to 619c39e5144f15aca129d6d999bcc5c34133ee64.
---
OpenSim/Region/UserStatistics/WebStatsModule.cs | 56 ++++++++++---------------
1 file changed, 21 insertions(+), 35 deletions(-)
(limited to 'OpenSim/Region/UserStatistics')
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 625eba4..c11ea02 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.UserStatistics
///
/// User statistics sessions keyed by agent ID
///
- private Dictionary m_sessions = new Dictionary();
+ private Dictionary m_sessions = new Dictionary();
private List m_scenes = new List();
private Dictionary reports = new Dictionary();
@@ -319,18 +319,14 @@ namespace OpenSim.Region.UserStatistics
private void OnMakeRootAgent(ScenePresence agent)
{
-// m_log.DebugFormat(
-// "[WEB STATS MODULE]: Looking for session {0} for {1} in {2}",
-// agent.ControllingClient.SessionId, agent.Name, agent.Scene.Name);
-
lock (m_sessions)
{
- UserSession uid;
+ UserSessionID uid;
if (!m_sessions.ContainsKey(agent.UUID))
{
UserSessionData usd = UserSessionUtil.newUserSessionData();
- uid = new UserSession();
+ uid = new UserSessionID();
uid.name_f = agent.Firstname;
uid.name_l = agent.Lastname;
uid.session_data = usd;
@@ -415,9 +411,9 @@ namespace OpenSim.Region.UserStatistics
return String.Empty;
}
- private UserSession ParseViewerStats(string request, UUID agentID)
+ private UserSessionID ParseViewerStats(string request, UUID agentID)
{
- UserSession uid = new UserSession();
+ UserSessionID uid = new UserSessionID();
UserSessionData usd;
OSD message = OSDParser.DeserializeLLSDXml(request);
OSDMap mmap;
@@ -429,25 +425,22 @@ namespace OpenSim.Region.UserStatistics
if (!m_sessions.ContainsKey(agentID))
{
m_log.WarnFormat("[WEB STATS MODULE]: no session for stat disclosure for agent {0}", agentID);
- return new UserSession();
+ return new UserSessionID();
}
-
uid = m_sessions[agentID];
-
-// m_log.DebugFormat("[WEB STATS MODULE]: Got session {0} for {1}", uid.session_id, agentID);
}
else
{
// parse through the beginning to locate the session
if (message.Type != OSDType.Map)
- return new UserSession();
+ return new UserSessionID();
mmap = (OSDMap)message;
{
UUID sessionID = mmap["session_id"].AsUUID();
if (sessionID == UUID.Zero)
- return new UserSession();
+ return new UserSessionID();
// search through each session looking for the owner
@@ -466,7 +459,7 @@ namespace OpenSim.Region.UserStatistics
// can't find a session
if (agentID == UUID.Zero)
{
- return new UserSession();
+ return new UserSessionID();
}
}
}
@@ -475,12 +468,12 @@ namespace OpenSim.Region.UserStatistics
usd = uid.session_data;
if (message.Type != OSDType.Map)
- return new UserSession();
+ return new UserSessionID();
mmap = (OSDMap)message;
{
if (mmap["agent"].Type != OSDType.Map)
- return new UserSession();
+ return new UserSessionID();
OSDMap agent_map = (OSDMap)mmap["agent"];
usd.agent_id = agentID;
usd.name_f = uid.name_f;
@@ -500,18 +493,17 @@ namespace OpenSim.Region.UserStatistics
(float)agent_map["fps"].AsReal());
if (mmap["downloads"].Type != OSDType.Map)
- return new UserSession();
+ return new UserSessionID();
OSDMap downloads_map = (OSDMap)mmap["downloads"];
usd.d_object_kb = (float)downloads_map["object_kbytes"].AsReal();
usd.d_texture_kb = (float)downloads_map["texture_kbytes"].AsReal();
usd.d_world_kb = (float)downloads_map["workd_kbytes"].AsReal();
-// m_log.DebugFormat("[WEB STATS MODULE]: mmap[\"session_id\"] = [{0}]", mmap["session_id"].AsUUID());
usd.session_id = mmap["session_id"].AsUUID();
if (mmap["system"].Type != OSDType.Map)
- return new UserSession();
+ return new UserSessionID();
OSDMap system_map = (OSDMap)mmap["system"];
usd.s_cpu = system_map["cpu"].AsString();
@@ -520,13 +512,13 @@ namespace OpenSim.Region.UserStatistics
usd.s_ram = system_map["ram"].AsInteger();
if (mmap["stats"].Type != OSDType.Map)
- return new UserSession();
+ return new UserSessionID();
OSDMap stats_map = (OSDMap)mmap["stats"];
{
if (stats_map["failures"].Type != OSDType.Map)
- return new UserSession();
+ return new UserSessionID();
OSDMap stats_failures = (OSDMap)stats_map["failures"];
usd.f_dropped = stats_failures["dropped"].AsInteger();
usd.f_failed_resends = stats_failures["failed_resends"].AsInteger();
@@ -535,18 +527,18 @@ namespace OpenSim.Region.UserStatistics
usd.f_send_packet = stats_failures["send_packet"].AsInteger();
if (stats_map["net"].Type != OSDType.Map)
- return new UserSession();
+ return new UserSessionID();
OSDMap stats_net = (OSDMap)stats_map["net"];
{
if (stats_net["in"].Type != OSDType.Map)
- return new UserSession();
+ return new UserSessionID();
OSDMap net_in = (OSDMap)stats_net["in"];
usd.n_in_kb = (float)net_in["kbytes"].AsReal();
usd.n_in_pk = net_in["packets"].AsInteger();
if (stats_net["out"].Type != OSDType.Map)
- return new UserSession();
+ return new UserSessionID();
OSDMap net_out = (OSDMap)stats_net["out"];
usd.n_out_kb = (float)net_out["kbytes"].AsReal();
@@ -557,18 +549,11 @@ namespace OpenSim.Region.UserStatistics
uid.session_data = usd;
m_sessions[agentID] = uid;
-
-// m_log.DebugFormat(
-// "[WEB STATS MODULE]: Parse data for {0} {1}, session {2}", uid.name_f, uid.name_l, uid.session_id);
-
return uid;
}
- private void UpdateUserStats(UserSession uid, SqliteConnection db)
+ private void UpdateUserStats(UserSessionID uid, SqliteConnection db)
{
-// m_log.DebugFormat(
-// "[WEB STATS MODULE]: Updating user stats for {0} {1}, session {2}", uid.name_f, uid.name_l, uid.session_id);
-
if (uid.session_id == UUID.Zero)
return;
@@ -755,6 +740,7 @@ VALUES
s.min_ping = ArrayMin_f(__ping);
s.max_ping = ArrayMax_f(__ping);
s.mode_ping = ArrayMode_f(__ping);
+
}
#region Statistics
@@ -999,7 +985,7 @@ VALUES
}
#region structs
- public class UserSession
+ public struct UserSessionID
{
public UUID session_id;
public UUID region_id;
--
cgit v1.1