From 0732b48be9c6378c31515ed92d29101e3743c8c9 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 13 Oct 2010 11:57:38 -0700 Subject: improved fastquit logic which should reliably disconnect viewer from sim --- indra/newview/llappviewer.cpp | 54 +++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 25 deletions(-) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 91fae709df..a245639fac 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1284,6 +1284,21 @@ bool LLAppViewer::mainLoop() return true; } +void LLAppViewer::flushVFSIO() +{ + while (1) + { + S32 pending = LLVFSThread::updateClass(0); + pending += LLLFSThread::updateClass(0); + if (!pending) + { + break; + } + llinfos << "Waiting for pending IO to finish: " << pending << llendflush; + ms_sleep(100); + } +} + bool LLAppViewer::cleanup() { // workaround for DEV-35406 crash on shutdown @@ -1419,17 +1434,7 @@ bool LLAppViewer::cleanup() llinfos << "Cache files removed" << llendflush; // Wait for any pending VFS IO - while (1) - { - S32 pending = LLVFSThread::updateClass(0); - pending += LLLFSThread::updateClass(0); - if (!pending) - { - break; - } - llinfos << "Waiting for pending IO to finish: " << pending << llendflush; - ms_sleep(100); - } + flushVFSIO(); llinfos << "Shutting down Views" << llendflush; // Destroy the UI @@ -2879,13 +2884,20 @@ void LLAppViewer::forceQuit() LLApp::setQuitting(); } -void LLAppViewer::fastQuit() +void LLAppViewer::fastQuit(S32 error_code) { - if (LLStartUp::getStartupState() >= STATE_STARTED) - { - sendLogoutRequest(); - } - _exit(isError()); + // finish pending transfers + flushVFSIO(); + // let sim know we're logging out + sendLogoutRequest(); + // flush network buffers by shutting down messaging system + end_messaging_system(); + // figure out the error code + S32 final_error_code = error_code ? error_code : (S32)isError(); + // this isn't a crash + removeMarkerFile(); + // get outta here + _exit(final_error_code); } void LLAppViewer::requestQuit() @@ -2973,14 +2985,6 @@ void LLAppViewer::earlyExitNoNotify() finish_early_exit( LLSD(), LLSD() ); } -void LLAppViewer::forceExit(S32 arg) -{ - removeMarkerFile(); - - // *FIX:Mani - This kind of exit hardly seems appropriate. - exit(arg); -} - void LLAppViewer::abortQuit() { llinfos << "abortQuit()" << llendl; -- cgit v1.2.3