Suppress negotiation timout log if signal disconnect (#1433)

* Suppress negotiation timout log if signal disconnect

* solve comment
This commit is contained in:
cnderrauber
2023-02-17 15:40:35 +08:00
committed by GitHub
parent 30834791fa
commit 6d16f061de
2 changed files with 9 additions and 1 deletions
+3 -1
View File
@@ -1962,7 +1962,9 @@ func (p *ParticipantImpl) onSubscriptionError(trackID livekit.TrackID) {
}
func (p *ParticipantImpl) onAnyTransportNegotiationFailed() {
p.params.Logger.Infow("negotiation failed, starting full reconnect")
if p.TransportManager.SinceLastSignal() < negotiationFailedTimeout {
p.params.Logger.Infow("negotiation failed, starting full reconnect")
}
p.IssueFullReconnect(types.ParticipantCloseReasonNegotiateFailed)
}
+6
View File
@@ -717,3 +717,9 @@ func (t *TransportManager) UpdateLastSeenSignal() {
t.lastSignalAt = time.Now()
t.lock.Unlock()
}
func (t *TransportManager) SinceLastSignal() time.Duration {
t.lock.RLock()
defer t.lock.RUnlock()
return time.Since(t.lastSignalAt)
}