Wait for response from SLVoice when sending shutdown.

meow-7.2.2
Aura Linden 2014-08-20 14:02:48 -07:00
parent eba76107ba
commit 86e2bd75bc
2 changed files with 12 additions and 4 deletions

View File

@ -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();

View File

@ -723,6 +723,7 @@ private:
bool mRenderDeviceDirty;
bool mIsInitialized;
bool mShutdownComplete;
bool checkParcelChanged(bool update = false);