aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-04-17 00:02:58 +0100
committerJustin Clark-Casey (justincc)2012-04-17 00:02:58 +0100
commitf213f55586b9af66955fdfccdd50237febaf98ca (patch)
treeae9e2e5c41efb7ec78e960ae0f09aa882f708066 /OpenSim/Region
parentAdd GroupPosition and GetWorldPosition() checks to TestGetRootPartPosition() (diff)
downloadopensim-SC_OLD-f213f55586b9af66955fdfccdd50237febaf98ca.zip
opensim-SC_OLD-f213f55586b9af66955fdfccdd50237febaf98ca.tar.gz
opensim-SC_OLD-f213f55586b9af66955fdfccdd50237febaf98ca.tar.bz2
opensim-SC_OLD-f213f55586b9af66955fdfccdd50237febaf98ca.tar.xz
Fix bug in WebStatsModule where an exception would always be output on update if the user teleported to another region on that simulator.
This was because update was looking for an existing stats record unique in session id, agent id and region id. But if the user teleports to another region then region id changes. WebStatsModule promptly doesn't find the existing record and tries to insert a new one, but only session id is the primary key and that's still the same, which makes things go bang. This makes the update search only on the unique session id. This is only an issue with simulators that have multiple regions where the webstats module is enabled.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs15
1 files changed, 10 insertions, 5 deletions
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index b9ba4bc..dbe9b3f 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -446,7 +446,7 @@ namespace OpenSim.Region.UserStatistics
446 { 446 {
447// m_log.DebugFormat("[WEB STATS MODULE]: Received viewer starts report from {0}", agentID); 447// m_log.DebugFormat("[WEB STATS MODULE]: Received viewer starts report from {0}", agentID);
448 448
449 UpdateUserStats(ParseViewerStats(request,agentID), dbConn); 449 UpdateUserStats(ParseViewerStats(request, agentID), dbConn);
450 450
451 return String.Empty; 451 return String.Empty;
452 } 452 }
@@ -654,8 +654,6 @@ namespace OpenSim.Region.UserStatistics
654 updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet)); 654 updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
655 655
656 updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString())); 656 updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
657 updatecmd.Parameters.Add(new SqliteParameter(":agent_key", uid.session_data.agent_id.ToString()));
658 updatecmd.Parameters.Add(new SqliteParameter(":region_key", uid.session_data.region_id.ToString()));
659 657
660// m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id); 658// m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id);
661 659
@@ -667,11 +665,18 @@ namespace OpenSim.Region.UserStatistics
667 665
668 updatecmd.CommandText = SQL_STATS_TABLE_INSERT; 666 updatecmd.CommandText = SQL_STATS_TABLE_INSERT;
669 667
668// StringBuilder parameters = new StringBuilder();
669// SqliteParameterCollection spc = updatecmd.Parameters;
670// foreach (SqliteParameter sp in spc)
671// parameters.AppendFormat("{0}={1},", sp.ParameterName, sp.Value);
672//
673// m_log.DebugFormat("[WEB STATS MODULE]: Parameters {0}", parameters);
674
670 try 675 try
671 { 676 {
672 updatecmd.ExecuteNonQuery(); 677 updatecmd.ExecuteNonQuery();
673 } 678 }
674 catch (Exception e) 679 catch (SqliteExecutionException e)
675 { 680 {
676 m_log.WarnFormat( 681 m_log.WarnFormat(
677 "[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}", 682 "[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}",
@@ -801,7 +806,7 @@ set session_id=:session_id,
801 f_off_circuit=:f_off_circuit, 806 f_off_circuit=:f_off_circuit,
802 f_resent=:f_resent, 807 f_resent=:f_resent,
803 f_send_packet=:f_send_packet 808 f_send_packet=:f_send_packet
804WHERE session_id=:session_key AND agent_id=:agent_key AND region_id=:region_key"; 809WHERE session_id=:session_key";
805 #endregion 810 #endregion
806 } 811 }
807 812