aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcrashlogger
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:37 -0500
committerJacek Antonelli2008-08-15 23:45:37 -0500
commit31ba05810c641f14e8ab5da8ad2aaf527779f6c1 (patch)
treec4b8d635dfb657fa4cfee7c285f8cadbf24afa90 /linden/indra/llcrashlogger
parentSecond Life viewer sources 1.19.1.1 (diff)
downloadmeta-impy-31ba05810c641f14e8ab5da8ad2aaf527779f6c1.zip
meta-impy-31ba05810c641f14e8ab5da8ad2aaf527779f6c1.tar.gz
meta-impy-31ba05810c641f14e8ab5da8ad2aaf527779f6c1.tar.bz2
meta-impy-31ba05810c641f14e8ab5da8ad2aaf527779f6c1.tar.xz
Second Life viewer sources 1.19.1.2
Diffstat (limited to 'linden/indra/llcrashlogger')
-rwxr-xr-xlinden/indra/llcrashlogger/llcrashlogger.cpp63
-rwxr-xr-xlinden/indra/llcrashlogger/llcrashlogger.h2
2 files changed, 36 insertions, 29 deletions
diff --git a/linden/indra/llcrashlogger/llcrashlogger.cpp b/linden/indra/llcrashlogger/llcrashlogger.cpp
index ebd2303..948932f 100755
--- a/linden/indra/llcrashlogger/llcrashlogger.cpp
+++ b/linden/indra/llcrashlogger/llcrashlogger.cpp
@@ -85,7 +85,8 @@ void LLCrashLoggerText::updateApplication(LLString message)
85LLCrashLogger::LLCrashLogger() : 85LLCrashLogger::LLCrashLogger() :
86 mCrashBehavior(CRASH_BEHAVIOR_ASK), 86 mCrashBehavior(CRASH_BEHAVIOR_ASK),
87 mCrashInPreviousExec(false), 87 mCrashInPreviousExec(false),
88 mSentCrashLogs(false) 88 mSentCrashLogs(false),
89 mCrashHost("")
89{ 90{
90 91
91} 92}
@@ -145,21 +146,14 @@ void LLCrashLogger::gatherFiles()
145 gatherPlatformSpecificFiles(); 146 gatherPlatformSpecificFiles();
146 147
147 //Use the debug log to reconstruct the URL to send the crash report to 148 //Use the debug log to reconstruct the URL to send the crash report to
148 mCrashHost = "https://"; 149 if(mDebugLog.has("CurrentSimHost"))
149 mCrashHost += mDebugLog["CurrentSimHost"].asString();
150 mCrashHost += ":12043/crash/report";
151 // Use login servers as the alternate, since they are already load balanced and have a known name
152 // First, check to see if we have a valid grid name. If not, use agni.
153 mAltCrashHost = "https://login.";
154 if(mDebugLog["GridName"].asString() != "")
155 {
156 mAltCrashHost += mDebugLog["GridName"].asString();
157 }
158 else
159 { 150 {
160 mAltCrashHost += "agni"; 151 mCrashHost = "https://";
152 mCrashHost += mDebugLog["CurrentSimHost"].asString();
153 mCrashHost += ":12043/crash/report";
161 } 154 }
162 mAltCrashHost += ".lindenlab.com:12043/crash/report"; 155 // Use login servers as the alternate, since they are already load balanced and have a known name
156 mAltCrashHost = "https://login.agni.lindenlab.com:12043/crash/report";
163 157
164 mCrashInfo["DebugLog"] = mDebugLog; 158 mCrashInfo["DebugLog"] = mDebugLog;
165 mFileMap["StatsLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stats.log"); 159 mFileMap["StatsLog"] = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"stats.log");
@@ -218,6 +212,26 @@ bool LLCrashLogger::saveCrashBehaviorSetting(S32 crash_behavior)
218 return true; 212 return true;
219} 213}
220 214
215bool LLCrashLogger::runCrashLogPost(LLString host, LLSD data, LLString msg, int retries, int timeout)
216{
217 gBreak = false;
218 LLString status_message;
219 for(int i = 0; i < retries; ++i)
220 {
221 status_message = llformat("%s, try %d...", msg.c_str(), i+1);
222 LLHTTPClient::post(host, data, new LLCrashLoggerResponder(), timeout);
223 while(!gBreak)
224 {
225 updateApplication(status_message);
226 }
227 if(gSent)
228 {
229 return gSent;
230 }
231 }
232 return gSent;
233}
234
221bool LLCrashLogger::sendCrashLogs() 235bool LLCrashLogger::sendCrashLogs()
222{ 236{
223 gatherFiles(); 237 gatherFiles();
@@ -234,27 +248,20 @@ bool LLCrashLogger::sendCrashLogs()
234 std::ofstream out_file(report_file.c_str()); 248 std::ofstream out_file(report_file.c_str());
235 LLSDSerialize::toPrettyXML(post_data, out_file); 249 LLSDSerialize::toPrettyXML(post_data, out_file);
236 out_file.close(); 250 out_file.close();
237 LLHTTPClient::post(mCrashHost, post_data, new LLCrashLoggerResponder(), 5);
238 251
239 gBreak = false; 252 bool sent = false;
240 while(!gBreak) 253
254 if(mCrashHost != "")
241 { 255 {
242 updateApplication("Sending logs..."); 256 sent = runCrashLogPost(mCrashHost, post_data, "Sending to server", 3, 5);
243 } 257 }
244 258
245 if(!gSent) 259 if(!sent)
246 { 260 {
247 gBreak = false; 261 sent = runCrashLogPost(mAltCrashHost, post_data, "Sending to alternate server", 3, 5);
248 LLHTTPClient::post(mAltCrashHost, post_data, new LLCrashLoggerResponder(), 5);
249
250 while(!gBreak)
251 {
252 updateApplication("Sending logs to Alternate Server...");
253 }
254 } 262 }
255 263
256 264 mSentCrashLogs = sent;
257 mSentCrashLogs = gSent;
258 265
259 return true; 266 return true;
260} 267}
diff --git a/linden/indra/llcrashlogger/llcrashlogger.h b/linden/indra/llcrashlogger/llcrashlogger.h
index d5618b7..bf51e71 100755
--- a/linden/indra/llcrashlogger/llcrashlogger.h
+++ b/linden/indra/llcrashlogger/llcrashlogger.h
@@ -56,11 +56,11 @@ public:
56 virtual bool cleanup() { return true; } 56 virtual bool cleanup() { return true; }
57 void setUserText(LLString& text) { mCrashInfo["UserNotes"] = text; } 57 void setUserText(LLString& text) { mCrashInfo["UserNotes"] = text; }
58 S32 getCrashBehavior() { return mCrashBehavior; } 58 S32 getCrashBehavior() { return mCrashBehavior; }
59 bool runCrashLogPost(LLString host, LLSD data, LLString msg, int retries, int timeout);
59protected: 60protected:
60 S32 mCrashBehavior; 61 S32 mCrashBehavior;
61 BOOL mCrashInPreviousExec; 62 BOOL mCrashInPreviousExec;
62 std::map<LLString, LLString> mFileMap; 63 std::map<LLString, LLString> mFileMap;
63 static const int mMaxSendSize = 200000;
64 LLString mGridName; 64 LLString mGridName;
65 LLControlGroup mCrashSettings; 65 LLControlGroup mCrashSettings;
66 LLString mProductName; 66 LLString mProductName;