Check for ICE connection before closing participant on signal close. (#4780)

* Check for ICE connection before closing participant on signal close.

Only close the participant if ICE has not connected by the time signal
source is closed. If ICE had connected, candidates have been exchanged
and link was established. So, it should be resumable.

Waiting for DTLS closed the participant sometimes in the windowa after
ICE connection, but before DTLS finishes and that unnecessarily closed
the participant forcing a full reconnect.

* variable name
This commit is contained in:
Raja Subramanian
2026-08-20 13:07:28 +05:30
committed by GitHub
parent c52b1b2a30
commit 972c64a29b
6 changed files with 127 additions and 40 deletions
+3 -3
View File
@@ -867,9 +867,9 @@ func (c *RTCClient) SetAttributes(attrs map[string]string) error {
func (c *RTCClient) hasPrimaryEverConnected() bool {
if c.subscriberAsPrimary.Load() {
return c.subscriber.HasEverConnected()
return c.subscriber.PeerConnectionHasEverConnected()
} else {
return c.publisher.HasEverConnected()
return c.publisher.PeerConnectionHasEverConnected()
}
}
@@ -1113,7 +1113,7 @@ func (c *RTCClient) ensurePublisherConnected() error {
return c.ctx.Err()
}
if c.publisher.HasEverConnected() {
if c.publisher.PeerConnectionHasEverConnected() {
return nil
}