fix(jitsi): reset reconnect limit by window start

This commit is contained in:
zarazaex69
2026-05-16 19:28:28 +03:00
parent cae76a6c34
commit 5d4592f055
+8 -7
View File
@@ -97,11 +97,11 @@ type Session struct {
closed atomic.Bool
reconnecting atomic.Bool
reconnectCh chan struct{}
lastReconnect time.Time
reconnectCount int
localEpoch atomic.Uint32
peerEpoch atomic.Uint32
reconnectCh chan struct{}
reconnectWindowStart time.Time
reconnectCount int
localEpoch atomic.Uint32
peerEpoch atomic.Uint32
// peerEndpoint latches the MUC nick of the first occupant whose
// EndpointMessage passed the bridgeMagic check. Once set, all bridge
@@ -952,11 +952,12 @@ func (s *Session) requestReconnect(reason string) {
}
func (s *Session) handleReconnectAttempt(ctx context.Context) bool {
if time.Since(s.lastReconnect) > reconnectWindow {
now := time.Now()
if s.reconnectWindowStart.IsZero() || now.Sub(s.reconnectWindowStart) > reconnectWindow {
s.reconnectWindowStart = now
s.reconnectCount = 0
}
s.reconnectCount++
s.lastReconnect = time.Now()
if s.reconnectCount > maxReconnects {
s.signalEnded("jitsi reconnect limit reached")