DRTVWR-476: Make LLVivoxVoiceClient::logoutOfVivox() wait for logout.

It can happen that we arrive at logoutOfVivox() with some other message
queued on the LLEventMailDrop in question. If logoutOfVivox() assumes that
other message is logout and exits, then subsequent code gets confused.
Introduce a loop to wait (with the existing timeout) for the real logout
message.
meow-7.2.2
Nat Goodspeed 2020-05-27 10:39:20 -04:00
parent 294fb30a3c
commit a0356e977d
1 changed files with 22 additions and 15 deletions

View File

@ -338,15 +338,15 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() :
mPlayRequestCount(0),
mAvatarNameCacheConnection(),
mIsInTuningMode(false),
mIsInChannel(false),
mIsJoiningSession(false),
mIsWaitingForFonts(false),
mIsLoggingIn(false),
mIsLoggedIn(false),
mIsProcessingChannels(false),
mIsCoroutineActive(false),
mVivoxPump("vivoxClientPump")
mIsInTuningMode(false),
mIsInChannel(false),
mIsJoiningSession(false),
mIsWaitingForFonts(false),
mIsLoggingIn(false),
mIsLoggedIn(false),
mIsProcessingChannels(false),
mIsCoroutineActive(false),
mVivoxPump("vivoxClientPump")
{
mSpeakerVolume = scale_speaker_volume(0);
@ -1255,15 +1255,22 @@ void LLVivoxVoiceClient::logoutOfVivox(bool wait)
if (wait)
{
LLSD timeoutResult(LLSDMap("logout", "timeout"));
LLSD result;
LL_DEBUGS("Voice")
<< "waiting for logout response on "
<< mVivoxPump.getName()
<< LL_ENDL;
do
{
LL_DEBUGS("Voice")
<< "waiting for logout response on "
<< mVivoxPump.getName()
<< LL_ENDL;
LLSD result = llcoro::suspendUntilEventOnWithTimeout(mVivoxPump, LOGOUT_ATTEMPT_TIMEOUT, timeoutResult);
result = llcoro::suspendUntilEventOnWithTimeout(mVivoxPump, LOGOUT_ATTEMPT_TIMEOUT, timeoutResult);
LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;
LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;
// Don't get confused by prior queued events -- note that it's
// very important that mVivoxPump is an LLEventMailDrop, which
// does queue events.
} while (! result["logout"]);
}
else
{