Fix some session shutdown/error handling code

meow-7.2.2
Roxie Linden 2024-05-08 14:22:43 -07:00
parent 74028326e8
commit c628c1f6e4
2 changed files with 36 additions and 56 deletions

View File

@ -496,11 +496,6 @@ void LLVoiceClient::leaveNonSpatialChannel()
mNonSpatialVoiceModule->processChannels(false);
mNonSpatialVoiceModule = nullptr;
}
if (mSpatialVoiceModule)
{
mSpatialVoiceModule->processChannels(true);
;
}
}
void LLVoiceClient::activateSpatialChannel(bool activate)

View File

@ -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)
{
mWebRTCPeerConnectionInterface->shutdownConnection();
}
setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
mOutstandingRequests--;
if (!LLWebRTCVoiceClient::isShuttingDown())
{
setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
}
}
// 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
{
// 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)
{
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)
{
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
{