summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2024-05-08 14:22:43 -0700
committerRoxie Linden <roxie@lindenlab.com>2024-05-08 14:22:43 -0700
commitc628c1f6e41f08c00540cf7f9ff3a5799faf0144 (patch)
tree4d51dd366e2e2ce69610a06e7ab767824ab8869c
parent74028326e8b81ec7ead20b1f2a4d7d1a7f4009d0 (diff)
Fix some session shutdown/error handling code
-rw-r--r--indra/newview/llvoiceclient.cpp5
-rw-r--r--indra/newview/llvoicewebrtc.cpp85
2 files changed, 35 insertions, 55 deletions
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 6eadc3892e..8bd3897761 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -496,11 +496,6 @@ void LLVoiceClient::leaveNonSpatialChannel()
mNonSpatialVoiceModule->processChannels(false);
mNonSpatialVoiceModule = nullptr;
}
- if (mSpatialVoiceModule)
- {
- mSpatialVoiceModule->processChannels(true);
- ;
- }
}
void LLVoiceClient::activateSpatialChannel(bool activate)
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp
index b5c93d87f5..e72d5e6066 100644
--- a/indra/newview/llvoicewebrtc.cpp
+++ b/indra/newview/llvoicewebrtc.cpp
@@ -2127,11 +2127,8 @@ LLVoiceWebRTCConnection::~LLVoiceWebRTCConnection()
// by llwebrtc::terminate() on shutdown.
return;
}
- if (mWebRTCPeerConnectionInterface)
- {
- llwebrtc::freePeerConnection(mWebRTCPeerConnectionInterface);
- mWebRTCPeerConnectionInterface = nullptr;
- }
+ mWebRTCPeerConnectionInterface->unsetSignalingObserver(this);
+ llwebrtc::freePeerConnection(mWebRTCPeerConnectionInterface);
}
@@ -2468,19 +2465,11 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro()
// also shut things down.
LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts);
- if (LLWebRTCVoiceClient::isShuttingDown())
- {
- mOutstandingRequests--;
- return;
- }
-
- if (mWebRTCPeerConnectionInterface)
+ mOutstandingRequests--;
+ if (!LLWebRTCVoiceClient::isShuttingDown())
{
- mWebRTCPeerConnectionInterface->shutdownConnection();
+ setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
}
- setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
-
- mOutstandingRequests--;
}
// Tell the simulator to tell the Secondlife WebRTC server that we want a voice
@@ -2555,7 +2544,7 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection()
mCurrentStatus = LLVoiceClientStatusObserver::ERROR_UNKNOWN;
break;
}
- setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
+ setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
}
mOutstandingRequests--;
}
@@ -2582,7 +2571,7 @@ void LLVoiceWebRTCConnection::OnVoiceConnectionRequestSuccess(const LLSD &result
else
{
LL_WARNS("Voice") << "Invalid voice provision request result:" << result << LL_ENDL;
- setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
+ setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
return;
}
@@ -2628,7 +2617,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE("VOICE_STATE_START_SESSION")
if (mShutDown)
{
- setVoiceConnectionState(VOICE_STATE_DISCONNECT);
+ setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
break;
}
mIceCompleted = false;
@@ -2648,7 +2637,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
{
if (mShutDown)
{
- setVoiceConnectionState(VOICE_STATE_DISCONNECT);
+ setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
}
break;
}
@@ -2656,7 +2645,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
case VOICE_STATE_REQUEST_CONNECTION:
if (mShutDown)
{
- setVoiceConnectionState(VOICE_STATE_DISCONNECT);
+ setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
break;
}
// Ask the sim to ask the Secondlife WebRTC server for a connection to
@@ -2752,20 +2741,20 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
case VOICE_STATE_SESSION_EXIT:
{
+ mWebRTCPeerConnectionInterface->shutdownConnection();
+
+ if (!mShutDown)
{
- if (!mShutDown)
- {
- mVoiceConnectionState = VOICE_STATE_START_SESSION;
- }
- else
+ mVoiceConnectionState = VOICE_STATE_START_SESSION;
+ }
+ else
+ {
+ // if we still have outstanding http or webrtc calls, wait for them to
+ // complete so we don't delete objects while they still may be used.
+ if (mOutstandingRequests <= 0)
{
- // if we still have outstanding http or webrtc calls, wait for them to
- // complete so we don't delete objects while they still may be used.
- if (mOutstandingRequests <= 0)
- {
- LLWebRTCVoiceClient::getInstance()->OnConnectionShutDown(mChannelID, mRegionID);
- return false;
- }
+ LLWebRTCVoiceClient::getInstance()->OnConnectionShutDown(mChannelID, mRegionID);
+ return false;
}
}
break;
@@ -2986,14 +2975,6 @@ LLVoiceWebRTCSpatialConnection::LLVoiceWebRTCSpatialConnection(const LLUUID &reg
LLVoiceWebRTCSpatialConnection::~LLVoiceWebRTCSpatialConnection()
{
- if (LLWebRTCVoiceClient::isShuttingDown())
- {
- // peer connection and observers will be cleaned up
- // by llwebrtc::terminate() on shutdown.
- return;
- }
- assert(mOutstandingRequests == 0);
- mWebRTCPeerConnectionInterface->unsetSignalingObserver(this);
}
void LLVoiceWebRTCSpatialConnection::setMuteMic(bool muted)
@@ -3032,14 +3013,6 @@ LLVoiceWebRTCAdHocConnection::LLVoiceWebRTCAdHocConnection(const LLUUID &regionI
LLVoiceWebRTCAdHocConnection::~LLVoiceWebRTCAdHocConnection()
{
- if (LLWebRTCVoiceClient::isShuttingDown())
- {
- // peer connection and observers will be cleaned up
- // by llwebrtc::terminate() on shutdown.
- return;
- }
- assert(mOutstandingRequests == 0);
- mWebRTCPeerConnectionInterface->unsetSignalingObserver(this);
}
// Add-hoc connections require a different channel type
@@ -3096,7 +3069,19 @@ void LLVoiceWebRTCAdHocConnection::requestVoiceConnection()
if (!status)
{
- setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
+ switch (status.getType())
+ {
+ case HTTP_CONFLICT:
+ mCurrentStatus = LLVoiceClientStatusObserver::ERROR_CHANNEL_FULL;
+ break;
+ case HTTP_UNAUTHORIZED:
+ mCurrentStatus = LLVoiceClientStatusObserver::ERROR_CHANNEL_LOCKED;
+ break;
+ default:
+ mCurrentStatus = LLVoiceClientStatusObserver::ERROR_UNKNOWN;
+ break;
+ }
+ setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
}
else
{