summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2026-09-16 13:44:34 -0700
committerRoxie Linden <roxie@lindenlab.com>2026-09-16 13:44:34 -0700
commit56d7fbfcea5a6e22cbce67eb6b5c2b1f73ac1d7e (patch)
tree9f5f920106de1742f3bd9a0d596700af488c045a /indra
parent0e1d25f52e6caf4210c86b6e0e4b4ac992a2b8cd (diff)
Voice wasn't automatically reconnecting after a voice server crash or restart
Shutdown code was added that cleaned up voice connections, which we should do during shutdown. However, we do reuse voice connections in cases like reconnects so we can't totally clean up the connections. Fixes #6251
Diffstat (limited to 'indra')
-rw-r--r--indra/llwebrtc/llwebrtc.cpp23
-rw-r--r--indra/llwebrtc/llwebrtc_impl.h5
2 files changed, 17 insertions, 11 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp
index b6b205e858..31bc0cf0c1 100644
--- a/indra/llwebrtc/llwebrtc.cpp
+++ b/indra/llwebrtc/llwebrtc.cpp
@@ -478,7 +478,7 @@ bool LLWebRTCImpl::terminate()
{
for (auto& connection : connections)
{
- connection->closeOnSignalingThread();
+ connection->closeOnSignalingThread(true);
}
// Destroy the connections here, on the signaling thread, while
// it's still running.
@@ -1137,13 +1137,13 @@ void LLWebRTCPeerConnectionImpl::terminate()
mWebRTCImpl->PostSignalingTask(
[self]()
{
- self->closeOnSignalingThread();
+ self->closeOnSignalingThread(false);
self->mPendingJobs--;
});
}
// Signaling thread only.
-void LLWebRTCPeerConnectionImpl::closeOnSignalingThread()
+void LLWebRTCPeerConnectionImpl::closeOnSignalingThread(bool webrtc_terminate)
{
// Stop issuing stats requests; one may already be in flight, and
// Close() below will flush it.
@@ -1194,13 +1194,16 @@ void LLWebRTCPeerConnectionImpl::closeOnSignalingThread()
observer->OnPeerConnectionClosed();
}
- // Nothing may call back into the viewer past this point. Connections
- // closed while the viewer is still running unset themselves as observers
- // when they're destroyed, but any that are left for llwebrtc::terminate()
- // to close deliberately don't -- they're torn down as soon as it returns,
- // so a late callback would be reaching into freed memory.
- mSignalingObserverList.clear();
- mDataObserverList.clear();
+ if (webrtc_terminate)
+ {
+ // Nothing may call back into the viewer past this point. Connections
+ // closed while the viewer is still running unset themselves as observers
+ // when they're destroyed, but any that are left for llwebrtc::terminate()
+ // to close deliberately don't -- they're torn down as soon as it returns,
+ // so a late callback would be reaching into freed memory.
+ mSignalingObserverList.clear();
+ mDataObserverList.clear();
+ }
}
void LLWebRTCPeerConnectionImpl::setSignalingObserver(LLWebRTCSignalingObserver *observer) { mSignalingObserverList.emplace_back(observer); }
diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h
index ae3a6a4903..c980b28d6e 100644
--- a/indra/llwebrtc/llwebrtc_impl.h
+++ b/indra/llwebrtc/llwebrtc_impl.h
@@ -600,10 +600,13 @@ class LLWebRTCPeerConnectionImpl : public LLWebRTCPeerConnectionInterface,
void init(LLWebRTCImpl * webrtc_impl);
// Posts closeOnSignalingThread() and returns immediately.
void terminate();
+
// The actual close. Signaling thread only. Callable directly (via a
// BlockingCall) when the caller needs the connection to be fully closed
// before it continues -- see LLWebRTCImpl::terminate().
- void closeOnSignalingThread();
+ // webrtc_terminate indicates we're shutting down the webrtc library,
+ // if not, we'll be reusing the peer connection for a reconnection
+ void closeOnSignalingThread(bool webrtc_terminate);
virtual void AddRef() const override = 0;
virtual webrtc::RefCountReleaseStatus Release() const override = 0;