summaryrefslogtreecommitdiff
path: root/indra/llwebrtc/llwebrtc.cpp
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2024-05-16 12:00:45 -0700
committerRoxie Linden <roxie@lindenlab.com>2024-05-16 12:00:45 -0700
commitc6e147ff224e1adc9a498d4a06ad54fff710d704 (patch)
treecb97291843f7784b33d2b3e369a91bd8b09f6e29 /indra/llwebrtc/llwebrtc.cpp
parent57b99aec74783c323738bd5a130c82c8dbf379c2 (diff)
Race condition resulted in close causing removal of peer connection while other jobs might be using it.
Diffstat (limited to 'indra/llwebrtc/llwebrtc.cpp')
-rw-r--r--indra/llwebrtc/llwebrtc.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp
index 97c04ae446..5c71831c65 100644
--- a/indra/llwebrtc/llwebrtc.cpp
+++ b/indra/llwebrtc/llwebrtc.cpp
@@ -670,24 +670,23 @@ void LLWebRTCPeerConnectionImpl::init(LLWebRTCImpl * webrtc_impl)
}
void LLWebRTCPeerConnectionImpl::terminate()
{
- rtc::scoped_refptr<webrtc::PeerConnectionInterface> connection;
- mPeerConnection.swap(connection);
- rtc::scoped_refptr<webrtc::DataChannelInterface> dataChannel;
- mDataChannel.swap(dataChannel);
- rtc::scoped_refptr<webrtc::MediaStreamInterface> localStream;
- mLocalStream.swap(localStream);
-
mWebRTCImpl->PostSignalingTask(
[=]()
{
- if (connection)
+ if (mDataChannel)
{
- connection->Close();
+ mDataChannel->UnregisterObserver();
+ mDataChannel->Close();
+ mDataChannel = nullptr;
}
- if (dataChannel)
+ if (mPeerConnection)
+ {
+ mPeerConnection->Close();
+ mPeerConnection = nullptr;
+ }
+ for (auto &observer : mSignalingObserverList)
{
- dataChannel->UnregisterObserver();
- dataChannel->Close();
+ observer->OnPeerConnectionClosed();
}
});
}