aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/UserStatistics
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-10-05 23:31:53 +0100
committerJustin Clark-Casey (justincc)2011-10-05 23:31:53 +0100
commit604708fc969b92af4f07d4acae9f3d15c7cee63e (patch)
treeaf43b536648e1a08859b2262a86c985bbfe760fd /OpenSim/Region/UserStatistics
parentRemove unused local variable i from OdeScene.Simulate() (diff)
downloadopensim-SC_OLD-604708fc969b92af4f07d4acae9f3d15c7cee63e.zip
opensim-SC_OLD-604708fc969b92af4f07d4acae9f3d15c7cee63e.tar.gz
opensim-SC_OLD-604708fc969b92af4f07d4acae9f3d15c7cee63e.tar.bz2
opensim-SC_OLD-604708fc969b92af4f07d4acae9f3d15c7cee63e.tar.xz
Change WebStatsModule to check its config properly, instead of catching the ineviable NullReferenceException!
Also, tidy up spacing.
Diffstat (limited to 'OpenSim/Region/UserStatistics')
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs41
1 files 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
71 71
72 public virtual void Initialise(Scene scene, IConfigSource config) 72 public virtual void Initialise(Scene scene, IConfigSource config)
73 { 73 {
74 IConfig cnfg; 74 IConfig cnfg = config.Configs["WebStats"];
75 try 75
76 { 76 if (cnfg != null)
77 cnfg = config.Configs["WebStats"];
78 enabled = cnfg.GetBoolean("enabled", false); 77 enabled = cnfg.GetBoolean("enabled", false);
79 }
80 catch (Exception)
81 {
82 enabled = false;
83 }
84 78
85 if (!enabled) 79 if (!enabled)
86 {
87 return; 80 return;
88 }
89 81
90 lock (m_scene) 82 lock (m_scene)
91 { 83 {
@@ -115,16 +107,13 @@ namespace OpenSim.Region.UserStatistics
115 reports.Add("clients.report", clientReport); 107 reports.Add("clients.report", clientReport);
116 reports.Add("sessions.report", sessionsReport); 108 reports.Add("sessions.report", sessionsReport);
117 109
118
119
120 //// 110 ////
121 // Add Your own Reports here (Do Not Modify Lines here Devs!) 111 // Add Your own Reports here (Do Not Modify Lines here Devs!)
122 //// 112 ////
123 113
124 //// 114 ////
125 // End Own reports section 115 // End Own reports section
126 //// 116 ////
127
128 117
129 MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest); 118 MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest);
130 MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest); 119 MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest);
@@ -265,7 +254,6 @@ namespace OpenSim.Region.UserStatistics
265 CreateTables(db); 254 CreateTables(db);
266 } 255 }
267 } 256 }
268
269 } 257 }
270 258
271 public void CreateTables(SqliteConnection db) 259 public void CreateTables(SqliteConnection db)
@@ -277,8 +265,6 @@ namespace OpenSim.Region.UserStatistics
277 createcmd.ExecuteNonQuery(); 265 createcmd.ExecuteNonQuery();
278 } 266 }
279 267
280
281
282 public virtual void PostInitialise() 268 public virtual void PostInitialise()
283 { 269 {
284 if (!enabled) 270 if (!enabled)
@@ -376,15 +362,11 @@ namespace OpenSim.Region.UserStatistics
376 } 362 }
377 } 363 }
378 364
379
380
381
382 public void OnMakeChildAgent(ScenePresence agent) 365 public void OnMakeChildAgent(ScenePresence agent)
383 { 366 {
384 367
385 } 368 }
386 369
387
388 public void OnClientClosed(UUID agentID, Scene scene) 370 public void OnClientClosed(UUID agentID, Scene scene)
389 { 371 {
390 lock (m_sessions) 372 lock (m_sessions)
@@ -394,7 +376,6 @@ namespace OpenSim.Region.UserStatistics
394 m_sessions.Remove(agentID); 376 m_sessions.Remove(agentID);
395 } 377 }
396 } 378 }
397
398 } 379 }
399 380
400 public string readLogLines(int amount) 381 public string readLogLines(int amount)
@@ -433,7 +414,6 @@ namespace OpenSim.Region.UserStatistics
433 fs.Close(); 414 fs.Close();
434 fs.Dispose(); 415 fs.Dispose();
435 return encoding.GetString(buffer); 416 return encoding.GetString(buffer);
436
437 } 417 }
438 418
439 public UUID GetRegionUUIDFromHandle(ulong regionhandle) 419 public UUID GetRegionUUIDFromHandle(ulong regionhandle)
@@ -448,6 +428,7 @@ namespace OpenSim.Region.UserStatistics
448 } 428 }
449 return UUID.Zero; 429 return UUID.Zero;
450 } 430 }
431
451 /// <summary> 432 /// <summary>
452 /// Callback for a viewerstats cap 433 /// Callback for a viewerstats cap
453 /// </summary> 434 /// </summary>
@@ -523,8 +504,6 @@ namespace OpenSim.Region.UserStatistics
523 504
524 usd = uid.session_data; 505 usd = uid.session_data;
525 506
526
527
528 if (message.Type != OSDType.Map) 507 if (message.Type != OSDType.Map)
529 return new UserSessionID(); 508 return new UserSessionID();
530 509
@@ -699,7 +678,6 @@ namespace OpenSim.Region.UserStatistics
699 678
700 } 679 }
701 } 680 }
702
703 } 681 }
704 682
705 #region SQL 683 #region SQL
@@ -824,6 +802,7 @@ set session_id=:session_id,
824WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"; 802WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key";
825 #endregion 803 #endregion
826 } 804 }
805
827 public static class UserSessionUtil 806 public static class UserSessionUtil
828 { 807 {
829 public static UserSessionData newUserSessionData() 808 public static UserSessionData newUserSessionData()
@@ -941,7 +920,6 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
941 return result / cnt; 920 return result / cnt;
942 } 921 }
943 922
944
945 public static float ArrayMode_f(float[] arr) 923 public static float ArrayMode_f(float[] arr)
946 { 924 {
947 List<float> mode = new List<float>(); 925 List<float> mode = new List<float>();
@@ -995,10 +973,8 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
995 } 973 }
996 974
997 return mode.ToArray()[0]; 975 return mode.ToArray()[0];
998
999 } 976 }
1000 977
1001
1002 public static int ArrayMode_i(int[] arr) 978 public static int ArrayMode_i(int[] arr)
1003 { 979 {
1004 List<int> mode = new List<int>(); 980 List<int> mode = new List<int>();
@@ -1052,7 +1028,6 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
1052 } 1028 }
1053 1029
1054 return mode.ToArray()[0]; 1030 return mode.ToArray()[0];
1055
1056 } 1031 }
1057 1032
1058 #endregion 1033 #endregion
@@ -1178,7 +1153,6 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
1178 public List<float> _sim_fps; 1153 public List<float> _sim_fps;
1179 public List<int> _agents_in_view; 1154 public List<int> _agents_in_view;
1180 } 1155 }
1181
1182 1156
1183 #endregion 1157 #endregion
1184 1158
@@ -1263,5 +1237,4 @@ WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"
1263 m_scriptLinesPerSecond = stats.StatsBlock[20].StatValue; 1237 m_scriptLinesPerSecond = stats.StatsBlock[20].StatValue;
1264 } 1238 }
1265 } 1239 }
1266 1240} \ No newline at end of file
1267}