diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index efe4f15b0067efa739ff5a8a1cb0978e452cc119..642c6c1f76c6e3c4cd757839d5d16e5cd48ad62b 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() << "</Request>" << "\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 10ebac730d68e0c6d2d5b8f34637ff507f4f3607..a4ec9f2a69271e0f2a50781653b558722883ae07 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);