diff options
| -rw-r--r-- | indra/newview/llvoicevivox.cpp | 44 | 
1 files changed, 36 insertions, 8 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 42a1cf95a7..a2c2a8629e 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -912,10 +912,12 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()      //---------------------------------------------------------------------      llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS); +    bool quiting = LLAppViewer::isExiting(); +      LL_DEBUGS("Voice") << "Connecting to vivox daemon:" << mDaemonHost << LL_ENDL;      LLVoiceVivoxStats::getInstance()->reset(); -    while (!mConnected) +    while (!mConnected && !quiting)      {          LLVoiceVivoxStats::getInstance()->connectionAttemptStart();          LL_DEBUGS("Voice") << "Attempting to connect to vivox daemon: " << mDaemonHost << LL_ENDL; @@ -930,10 +932,16 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()          if (!mConnected)          {              llcoro::suspendUntilTimeout(DAEMON_CONNECT_THROTTLE_SECONDS); +            quiting = LLAppViewer::isExiting();          }      }      //--------------------------------------------------------------------- +    if (quiting && !mConnected) +    { +        return false; +    } +      llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS);      while (!mPump) @@ -970,11 +978,13 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()  {      LL_INFOS("Voice") << "Provisioning voice account." << LL_ENDL; -    while (!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived()) +    bool quiting = LLApp::isExiting(); +    while ((!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived()) && !quiting)      {          LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL;          // *TODO* Pump a message for wake up.          llcoro::suspend(); +        quiting = LLApp::isExiting();      }      std::string url = gAgent.getRegionCapability("ProvisionVoiceAccountRequest"); @@ -994,6 +1004,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()      {          LLVoiceVivoxStats::getInstance()->provisionAttemptStart();          result = httpAdapter->postAndSuspend(httpRequest, url, LLSD(), httpOpts); +        quiting = LLApp::isExiting();          LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];          LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -1003,6 +1014,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()              F32 timeout = pow(PROVISION_RETRY_TIMEOUT, static_cast<float>(retryCount));              LL_WARNS("Voice") << "Provision CAP 404.  Retrying in " << timeout << " seconds." << LL_ENDL;              llcoro::suspendUntilTimeout(timeout); +            quiting = LLApp::isExiting();          }          else if (!status)          { @@ -1014,10 +1026,15 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()          {              provisioned = true;          }         -    } while (!provisioned && retryCount <= PROVISION_RETRY_MAX); +    } while (!provisioned && retryCount <= PROVISION_RETRY_MAX && !quiting); + +    if (quiting && !provisioned) +    { +        return false; +    }      LLVoiceVivoxStats::getInstance()->provisionAttemptEnd(provisioned); -    if (! provisioned ) +    if (!provisioned)      {          LL_WARNS("Voice") << "Could not access voice provision cap after " << retryCount << " attempts." << LL_ENDL;          return false; @@ -1062,6 +1079,7 @@ bool LLVivoxVoiceClient::establishVoiceConnection()      LLSD result;      bool connected(false);      bool giving_up(false); +    bool quiting = LLApp::isExiting();      int retries = 0;      LL_INFOS("Voice") << "Requesting connection to voice service" << LL_ENDL; @@ -1070,6 +1088,7 @@ bool LLVivoxVoiceClient::establishVoiceConnection()      do      {          result = llcoro::suspendUntilEventOn(mVivoxPump); +        quiting = LLApp::isExiting();          LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;          if (result.has("connector")) @@ -1078,12 +1097,13 @@ bool LLVivoxVoiceClient::establishVoiceConnection()              connected = LLSD::Boolean(result["connector"]);              if (!connected)              { -                if (result.has("retry") && ++retries <= CONNECT_RETRY_MAX) +                if (result.has("retry") && ++retries <= CONNECT_RETRY_MAX && !quiting)                  {                      F32 timeout = LLSD::Real(result["retry"]);                      timeout *= retries;                      LL_INFOS("Voice") << "Retry connection to voice service in " << timeout << " seconds" << LL_ENDL;                      llcoro::suspendUntilTimeout(timeout); +                    quiting = LLApp::isExiting();                      if (mVoiceEnabled) // user may have switched it off                      { @@ -1106,7 +1126,7 @@ bool LLVivoxVoiceClient::establishVoiceConnection()          LL_DEBUGS("Voice") << (connected ? "" : "not ") << "connected, "                             << (giving_up ? "" : "not ") << "giving up"                             << LL_ENDL; -    } while (!connected && !giving_up); +    } while (!connected && !giving_up && !quiting);      if (giving_up)      { @@ -1176,6 +1196,7 @@ bool LLVivoxVoiceClient::loginToVivox()      bool response_ok(false);      bool account_login(false);      bool send_login(true); +    bool quiting = LLApp::isExiting();      do       { @@ -1187,13 +1208,14 @@ bool LLVivoxVoiceClient::loginToVivox()          }          LLSD result = llcoro::suspendUntilEventOnWithTimeout(mVivoxPump, LOGIN_ATTEMPT_TIMEOUT, timeoutResult); +        quiting = LLApp::isExiting();          LL_DEBUGS("Voice") << "event=" << ll_stream_notation_sd(result) << LL_ENDL;          if (result.has("login"))          {              std::string loginresp = result["login"]; -            if ((loginresp == "retry") || (loginresp == "timeout")) +            if (((loginresp == "retry") || (loginresp == "timeout")) && !quiting)              {                  LL_WARNS("Voice") << "login failed with status '" << loginresp << "' "                                    << " count " << loginRetryCount << "/" << LOGIN_RETRY_MAX @@ -1221,6 +1243,7 @@ bool LLVivoxVoiceClient::loginToVivox()                  LL_WARNS("Voice") << "login " << loginresp << " will retry login in " << timeout << " seconds." << LL_ENDL;                  llcoro::suspendUntilTimeout(timeout); +                quiting = LLApp::isExiting();              }              else if (loginresp == "failed")              { @@ -1235,9 +1258,14 @@ bool LLVivoxVoiceClient::loginToVivox()              {                  account_login = true;              } +            else if (quiting) +            { +                mIsLoggingIn = false; +                return false; +            }          } -    } while (!response_ok || !account_login); +    } while ((!response_ok || !account_login) && !quiting);      mRelogRequested = false;      mIsLoggedIn = true;  | 
