From 604708fc969b92af4f07d4acae9f3d15c7cee63e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 5 Oct 2011 23:31:53 +0100
Subject: Change WebStatsModule to check its config properly, instead of
catching the ineviable NullReferenceException!
Also, tidy up spacing.
---
OpenSim/Region/UserStatistics/WebStatsModule.cs | 41 +++++--------------------
1 file changed, 7 insertions(+), 34 deletions(-)
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 3139b8a..fc95189 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -71,21 +71,13 @@ namespace OpenSim.Region.UserStatistics
public virtual void Initialise(Scene scene, IConfigSource config)
{
- IConfig cnfg;
- try
- {
- cnfg = config.Configs["WebStats"];
+ IConfig cnfg = config.Configs["WebStats"];
+
+ if (cnfg != null)
enabled = cnfg.GetBoolean("enabled", false);
- }
- catch (Exception)
- {
- enabled = false;
- }
if (!enabled)
- {
return;
- }
lock (m_scene)
{
@@ -115,16 +107,13 @@ namespace OpenSim.Region.UserStatistics
reports.Add("clients.report", clientReport);
reports.Add("sessions.report", sessionsReport);
-
-
////
// Add Your own Reports here (Do Not Modify Lines here Devs!)
////
////
// End Own reports section
- ////
-
+ ////
MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest);
MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest);
@@ -265,7 +254,6 @@ namespace OpenSim.Region.UserStatistics
CreateTables(db);
}
}
-
}
public void CreateTables(SqliteConnection db)
@@ -277,8 +265,6 @@ namespace OpenSim.Region.UserStatistics
createcmd.ExecuteNonQuery();
}
-
-
public virtual void PostInitialise()
{
if (!enabled)
@@ -376,15 +362,11 @@ namespace OpenSim.Region.UserStatistics
}
}
-
-
-
public void OnMakeChildAgent(ScenePresence agent)
{
}
-
public void OnClientClosed(UUID agentID, Scene scene)
{
lock (m_sessions)
@@ -394,7 +376,6 @@ namespace OpenSim.Region.UserStatistics
m_sessions.Remove(agentID);
}
}
-
}
public string readLogLines(int amount)
@@ -433,7 +414,6 @@ namespace OpenSim.Region.UserStatistics
fs.Close();
fs.Dispose();
return encoding.GetString(buffer);
-
}
public UUID GetRegionUUIDFromHandle(ulong regionhandle)
@@ -448,6 +428,7 @@ namespace OpenSim.Region.UserStatistics
}
return UUID.Zero;
}
+
///
/// Callback for a viewerstats cap
///
@@ -523,8 +504,6 @@ namespace OpenSim.Region.UserStatistics
usd = uid.session_data;
-
-
if (message.Type != OSDType.Map)
return new UserSessionID();
@@ -699,7 +678,6 @@ namespace OpenSim.Region.UserStatistics
}
}
-
}
#region SQL
@@ -824,6 +802,7 @@ set session_id=:session_id,
WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key";
#endregion
}
+
public static class UserSessionUtil
{
public static UserSessionData newUserSessionData()
@@ -941,7 +920,6 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
return result / cnt;
}
-
public static float ArrayMode_f(float[] arr)
{
List mode = new List();
@@ -995,10 +973,8 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
}
return mode.ToArray()[0];
-
}
-
public static int ArrayMode_i(int[] arr)
{
List mode = new List();
@@ -1052,7 +1028,6 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
}
return mode.ToArray()[0];
-
}
#endregion
@@ -1178,7 +1153,6 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
public List _sim_fps;
public List _agents_in_view;
}
-
#endregion
@@ -1263,5 +1237,4 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
m_scriptLinesPerSecond = stats.StatsBlock[20].StatValue;
}
}
-
-}
+}
\ No newline at end of file
--
cgit v1.1