summaryrefslogtreecommitdiff
path: root/indra/newview/llvoicevivox.cpp
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2020-09-22 22:22:21 +0000
committerDave Houlton <euclid@lindenlab.com>2020-09-22 22:22:21 +0000
commit364ba9978b42ca03c39ee63c23fc1378e410ca96 (patch)
treea5ebd2bd8a4d6e87f55d1be6f278b1807b53de0f /indra/newview/llvoicevivox.cpp
parentb62d7c2f06fdaa91312fd6857d03748defe8b60f (diff)
parent86e7cc3d35e41a88b25175bafb5687e1864423d9 (diff)
Merged in DV497-merge-6.4.9 (pull request #312)
Merge 6.4.9 into DRTVWR-497
Diffstat (limited to 'indra/newview/llvoicevivox.cpp')
-rw-r--r--indra/newview/llvoicevivox.cpp81
1 files changed, 63 insertions, 18 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 42a1cf95a7..976ef61d8e 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -274,6 +274,8 @@ static void killGateway()
///////////////////////////////////////////////////////////////////////////////////////////////
+bool LLVivoxVoiceClient::sShuttingDown = false;
+
LLVivoxVoiceClient::LLVivoxVoiceClient() :
mSessionTerminateRequested(false),
mRelogRequested(false),
@@ -381,6 +383,7 @@ LLVivoxVoiceClient::~LLVivoxVoiceClient()
{
mAvatarNameCacheConnection.disconnect();
}
+ sShuttingDown = true;
}
//---------------------------------------------------
@@ -411,8 +414,11 @@ void LLVivoxVoiceClient::terminate()
}
else
{
+ mRelogRequested = false;
killGateway();
}
+
+ sShuttingDown = true;
}
//---------------------------------------------------
@@ -660,12 +666,18 @@ void LLVivoxVoiceClient::voiceControlCoro()
U32 retry = 0;
- while (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
+ while (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE && !sShuttingDown)
{
LL_DEBUGS("Voice") << "Suspending voiceControlCoro() momentarily for teleport. Tuning: " << mTuningMode << ". Relog: " << mRelogRequested << LL_ENDL;
llcoro::suspendUntilTimeout(1.0);
}
+ if (sShuttingDown)
+ {
+ mIsCoroutineActive = false;
+ return;
+ }
+
do
{
bool success = startAndConnectSession();
@@ -691,7 +703,7 @@ void LLVivoxVoiceClient::voiceControlCoro()
<< "disconnected"
<< " RelogRequested=" << mRelogRequested
<< LL_ENDL;
- if (mRelogRequested)
+ if (mRelogRequested && !sShuttingDown)
{
if (!success)
{
@@ -706,14 +718,14 @@ void LLVivoxVoiceClient::voiceControlCoro()
LL_INFOS("Voice") << "will attempt to reconnect to voice" << LL_ENDL;
}
- while (isGatewayRunning() || gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
+ while (isGatewayRunning() || (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE && !sShuttingDown))
{
LL_INFOS("Voice") << "waiting for SLVoice to exit" << LL_ENDL;
llcoro::suspendUntilTimeout(1.0);
}
}
}
- while (mVoiceEnabled && mRelogRequested);
+ while (mVoiceEnabled && mRelogRequested && !sShuttingDown);
mIsCoroutineActive = false;
LL_INFOS("Voice") << "exiting" << LL_ENDL;
}
@@ -758,7 +770,7 @@ bool LLVivoxVoiceClient::endAndDisconnectSession()
bool LLVivoxVoiceClient::callbackEndDaemon(const LLSD& data)
{
- if (!LLAppViewer::isExiting() && mVoiceEnabled)
+ if (!sShuttingDown && mVoiceEnabled)
{
LL_WARNS("Voice") << "SLVoice terminated " << ll_stream_notation_sd(data) << LL_ENDL;
terminateAudioSession(false);
@@ -915,7 +927,7 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
LL_DEBUGS("Voice") << "Connecting to vivox daemon:" << mDaemonHost << LL_ENDL;
LLVoiceVivoxStats::getInstance()->reset();
- while (!mConnected)
+ while (!mConnected && !sShuttingDown)
{
LLVoiceVivoxStats::getInstance()->connectionAttemptStart();
LL_DEBUGS("Voice") << "Attempting to connect to vivox daemon: " << mDaemonHost << LL_ENDL;
@@ -934,6 +946,11 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
}
//---------------------------------------------------------------------
+ if (sShuttingDown && !mConnected)
+ {
+ return false;
+ }
+
llcoro::suspendUntilTimeout(UPDATE_THROTTLE_SECONDS);
while (!mPump)
@@ -970,7 +987,7 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()
{
LL_INFOS("Voice") << "Provisioning voice account." << LL_ENDL;
- while (!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived())
+ while ((!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived()) && !sShuttingDown)
{
LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL;
// *TODO* Pump a message for wake up.
@@ -1014,10 +1031,15 @@ bool LLVivoxVoiceClient::provisionVoiceAccount()
{
provisioned = true;
}
- } while (!provisioned && retryCount <= PROVISION_RETRY_MAX);
+ } while (!provisioned && retryCount <= PROVISION_RETRY_MAX && !sShuttingDown);
+
+ if (sShuttingDown && !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;
@@ -1058,6 +1080,11 @@ bool LLVivoxVoiceClient::establishVoiceConnection()
LL_WARNS("Voice") << "cannot establish connection; enabled "<<mVoiceEnabled<<" initialized "<<mIsInitialized<<LL_ENDL;
return false;
}
+
+ if (sShuttingDown)
+ {
+ return false;
+ }
LLSD result;
bool connected(false);
@@ -1078,7 +1105,7 @@ 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 && !sShuttingDown)
{
F32 timeout = LLSD::Real(result["retry"]);
timeout *= retries;
@@ -1106,7 +1133,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 && !sShuttingDown);
if (giving_up)
{
@@ -1193,7 +1220,7 @@ bool LLVivoxVoiceClient::loginToVivox()
{
std::string loginresp = result["login"];
- if ((loginresp == "retry") || (loginresp == "timeout"))
+ if (((loginresp == "retry") || (loginresp == "timeout")) && !sShuttingDown)
{
LL_WARNS("Voice") << "login failed with status '" << loginresp << "' "
<< " count " << loginRetryCount << "/" << LOGIN_RETRY_MAX
@@ -1235,9 +1262,14 @@ bool LLVivoxVoiceClient::loginToVivox()
{
account_login = true;
}
+ else if (sShuttingDown)
+ {
+ mIsLoggingIn = false;
+ return false;
+ }
}
- } while (!response_ok || !account_login);
+ } while ((!response_ok || !account_login) && !sShuttingDown);
mRelogRequested = false;
mIsLoggedIn = true;
@@ -1690,12 +1722,12 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
// the region chat.
mSessionTerminateRequested = false;
- bool status=((mVoiceEnabled || !mIsInitialized) && !mRelogRequested && !LLApp::isExiting());
+ bool status=((mVoiceEnabled || !mIsInitialized) && !mRelogRequested && !sShuttingDown);
LL_DEBUGS("Voice") << "exiting"
<< " VoiceEnabled " << mVoiceEnabled
<< " IsInitialized " << mIsInitialized
<< " RelogRequested " << mRelogRequested
- << " AppExiting " << LLApp::isExiting()
+ << " ShuttingDown " << (sShuttingDown ? "TRUE" : "FALSE")
<< " returning " << status
<< LL_ENDL;
return status;
@@ -1733,6 +1765,12 @@ bool LLVivoxVoiceClient::waitForChannel()
mIsProcessingChannels = true;
llcoro::suspend();
+ if (sShuttingDown)
+ {
+ mRelogRequested = false;
+ break;
+ }
+
if (mTuningMode)
{
performMicTuning();
@@ -1777,7 +1815,14 @@ bool LLVivoxVoiceClient::waitForChannel()
{
llcoro::suspendUntilTimeout(1.0);
}
- } while (mVoiceEnabled && !mRelogRequested);
+
+ if (sShuttingDown)
+ {
+ mRelogRequested = false;
+ break;
+ }
+
+ } while (mVoiceEnabled && !mRelogRequested && !sShuttingDown);
LL_DEBUGS("Voice")
<< "leaving inner waitForChannel loop"
@@ -1799,14 +1844,14 @@ bool LLVivoxVoiceClient::waitForChannel()
return false;
}
}
- } while (mVoiceEnabled && mRelogRequested && isGatewayRunning());
+ } while (mVoiceEnabled && mRelogRequested && isGatewayRunning() && !sShuttingDown);
LL_DEBUGS("Voice")
<< "exiting"
<< " RelogRequested=" << mRelogRequested
<< " VoiceEnabled=" << mVoiceEnabled
<< LL_ENDL;
- return true;
+ return !sShuttingDown;
}
bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session)