From 86e2bd75bc6a04fa175a0ac9df51371498355f58 Mon Sep 17 00:00:00 2001 From: Aura Linden Date: Wed, 20 Aug 2014 14:02:48 -0700 Subject: Wait for response from SLVoice when sending shutdown. --- indra/newview/llvoicevivox.cpp | 15 +++++++++++---- indra/newview/llvoicevivox.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index efe4f15b00..642c6c1f76 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -323,6 +323,7 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() : mCaptureBufferRecording(false), mCaptureBufferRecorded(false), mCaptureBufferPlaying(false), + mShutdownComplete(true), mPlayRequestCount(0), mAvatarNameCacheConnection() @@ -377,7 +378,14 @@ void LLVivoxVoiceClient::terminate() if(mConnected) { logout(); - connectorShutdown(); + connectorShutdown(); + int count=0; + while (!mShutdownComplete && 10 > count++) + { + stateMachine(); + _sleep(1000); + } + closeSocket(); // Need to do this now -- bad things happen if the destructor does it later. cleanUp(); } @@ -512,6 +520,7 @@ void LLVivoxVoiceClient::connectorShutdown() << "" << "\n\n\n"; + mShutdownComplete = false; mConnectorHandle.clear(); writeString(stream.str()); @@ -1564,6 +1573,7 @@ void LLVivoxVoiceClient::stateMachine() //MARK: stateConnectorStopping case stateConnectorStopping: // waiting for connector stop // The handler for the Connector.InitiateShutdown response will transition from here to stateConnectorStopped. + mShutdownComplete = true; break; //MARK: stateConnectorStopped @@ -1643,9 +1653,6 @@ void LLVivoxVoiceClient::stateMachine() void LLVivoxVoiceClient::closeSocket(void) { -#ifdef LL_WINDOWS - _sleep(3000); //Wait a moment for socket to close. -#endif mSocket.reset(); mConnected = false; mConnectorHandle.clear(); diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 10ebac730d..a4ec9f2a69 100755 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -723,6 +723,7 @@ private: bool mRenderDeviceDirty; bool mIsInitialized; + bool mShutdownComplete; bool checkParcelChanged(bool update = false); -- cgit v1.2.3