From ff19d02bdbc8179cf413d5060e04bc627c2bea26 Mon Sep 17 00:00:00 2001
From: Armin Weatherwax
Date: Tue, 22 Mar 2011 02:32:25 +0100
Subject: Don't report crashes if the grid where the crash happened is
 different from the grid logging in.

Because otherwise crash statistics are wrong. See viewers with higher crash than disconnect rate.
---
 linden/indra/newview/app_settings/settings.xml | 11 +++++++++++
 linden/indra/newview/llstartup.cpp             | 23 +++++++++++++++++++++--
 2 files changed, 32 insertions(+), 2 deletions(-)

(limited to 'linden')

diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index c381d99..315670c 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -677,6 +677,17 @@
     <key>Value</key>
     <string>Random</string>
   </map>
+  <key>LastConnectedGrid</key>
+  <map>
+    <key>Comment</key>
+    <string>Last grid actually connected to</string>
+    <key>Persist</key>
+    <integer>1</integer>
+    <key>Type</key>
+    <string>String</string>
+    <key>Value</key>
+    <string />
+  </map>
   <key>LastSelectedGrid</key>
   <map>
     <key>Comment</key>
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index c9cdc8f..bcac095 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -1243,6 +1243,20 @@ bool idle_startup()
 		hashed_mac.finalize();
 		hashed_mac.hex_digest(hashed_mac_string);
 
+		// Don't report crashes if the grid we crashed in
+		// is different from the grid we log in
+		eLastExecEvent last_exec_event = LAST_EXEC_NORMAL;
+		{
+			std::string current_grid = gHippoGridManager->getCurrentGrid()->getGridNick();
+			std::string last_grid = gSavedSettings.getString("LastConnectedGrid");
+			LL_DEBUGS("AppInit")	<< "current grid: " << current_grid 
+						<< " Last Connected Grid: " << last_grid << LL_ENDL;
+			if( last_grid ==  current_grid )
+			{
+				last_exec_event = gLastExecEvent;
+			}
+		}
+
 		// TODO if statement here to use web_login_key
 		if(web_login_key.isNull()){
 		sAuthUriNum = llclamp(sAuthUriNum, 0, (S32)sAuthUris.size()-1);
@@ -1257,7 +1271,7 @@ bool idle_startup()
 			gSkipOptionalUpdate,
 			gAcceptTOS,
 			gAcceptCriticalMessage,
-			gLastExecEvent,
+			last_exec_event,
 			requested_options,
 			hashed_mac_string,
 			LLAppViewer::instance()->getSerialNumber());
@@ -1272,7 +1286,7 @@ bool idle_startup()
 			gSkipOptionalUpdate,
 			gAcceptTOS,
 			gAcceptCriticalMessage,
-			gLastExecEvent,
+			last_exec_event,
 			requested_options,
 			hashed_mac_string,
 			LLAppViewer::instance()->getSerialNumber());
@@ -1510,6 +1524,11 @@ bool idle_startup()
 
 		if(successful_login)
 		{
+			{
+				std::string current_grid = gHippoGridManager->getConnectedGrid()->getGridNick();
+				gSavedSettings.setString("LastConnectedGrid", current_grid);
+			}
+
 			std::string text;
 			text = LLUserAuth::getInstance()->getResponse("udp_blacklist");
 			if(!text.empty())
-- 
cgit v1.1