Reduce ghost participant disconnect timeout (#2077)

It's been reported that "ghost" participants, those that did not terminate
cleanly, hang around the room for too long after they disappear.

Evaluating our timeouts a bit, it seems that we are really conservative
in waiting for participants to disconnect. This PR cuts down the disconnect
timeout from 50s to 20s, a 30s reduction.
This commit is contained in:
David Zhao
2023-09-16 00:15:04 -07:00
committed by GitHub
parent f29887dcd0
commit 340906267f
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -56,7 +56,7 @@ const (
sdBatchSize = 30 sdBatchSize = 30
rttUpdateInterval = 5 * time.Second rttUpdateInterval = 5 * time.Second
disconnectCleanupDuration = 15 * time.Second disconnectCleanupDuration = 5 * time.Second
migrationWaitDuration = 3 * time.Second migrationWaitDuration = 3 * time.Second
) )
@@ -561,7 +561,9 @@ func (p *ParticipantImpl) HandleSignalSourceClose() {
p.TransportManager.SetSignalSourceValid(false) p.TransportManager.SetSignalSourceValid(false)
if !p.TransportManager.HasPublisherEverConnected() && !p.TransportManager.HasSubscriberEverConnected() { if !p.TransportManager.HasPublisherEverConnected() && !p.TransportManager.HasSubscriberEverConnected() {
p.params.Logger.Infow("closing disconnected participant") p.params.Logger.Infow("closing disconnected participant",
"reason", types.ParticipantCloseReasonJoinFailed,
)
_ = p.Close(false, types.ParticipantCloseReasonJoinFailed, false) _ = p.Close(false, types.ParticipantCloseReasonJoinFailed, false)
} }
} }
@@ -1402,7 +1404,9 @@ func (p *ParticipantImpl) setupDisconnectTimer() {
if p.IsClosed() || p.IsDisconnected() { if p.IsClosed() || p.IsDisconnected() {
return return
} }
p.params.Logger.Infow("closing disconnected participant") p.params.Logger.Infow("closing disconnected participant",
"reason", types.ParticipantCloseReasonPeerConnectionDisconnected,
)
_ = p.Close(true, types.ParticipantCloseReasonPeerConnectionDisconnected, false) _ = p.Close(true, types.ParticipantCloseReasonPeerConnectionDisconnected, false)
}) })
p.lock.Unlock() p.lock.Unlock()
+1 -1
View File
@@ -60,7 +60,7 @@ const (
dtlsRetransmissionInterval = 100 * time.Millisecond dtlsRetransmissionInterval = 100 * time.Millisecond
iceDisconnectedTimeout = 10 * time.Second // compatible for ice-lite with firefox client iceDisconnectedTimeout = 10 * time.Second // compatible for ice-lite with firefox client
iceFailedTimeout = 25 * time.Second // pion's default iceFailedTimeout = 5 * time.Second // time between disconnected and failed
iceKeepaliveInterval = 2 * time.Second // pion's default iceKeepaliveInterval = 2 * time.Second // pion's default
minTcpICEConnectTimeout = 5 * time.Second minTcpICEConnectTimeout = 5 * time.Second