mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Fix Controlled agent candidate selection timeout
Before if Controlled side never got any candidates it would never properly shut down. We never checked the start time against candidateSelectionTimeout Resolves pion/webrtc#854
This commit is contained in:
committed by
Sean DuBois
parent
b0ac6d9c37
commit
377e52e387
+13
-5
@@ -190,11 +190,14 @@ func (s *controllingSelector) PingCandidate(local, remote Candidate) {
|
||||
}
|
||||
|
||||
type controlledSelector struct {
|
||||
agent *Agent
|
||||
log logging.LeveledLogger
|
||||
startTime time.Time
|
||||
agent *Agent
|
||||
log logging.LeveledLogger
|
||||
}
|
||||
|
||||
func (s *controlledSelector) Start() {}
|
||||
func (s *controlledSelector) Start() {
|
||||
s.startTime = time.Now()
|
||||
}
|
||||
|
||||
func (s *controlledSelector) ContactCandidates() {
|
||||
if s.agent.selectedPair != nil {
|
||||
@@ -203,8 +206,13 @@ func (s *controlledSelector) ContactCandidates() {
|
||||
s.agent.checkKeepalive()
|
||||
}
|
||||
} else {
|
||||
s.log.Trace("pinging all candidates")
|
||||
s.agent.pingAllCandidates()
|
||||
if time.Since(s.startTime) > s.agent.candidateSelectionTimeout {
|
||||
s.log.Trace("check timeout reached and no valid candidate pair found, marking connection as failed")
|
||||
s.agent.updateConnectionState(ConnectionStateFailed)
|
||||
} else {
|
||||
s.log.Trace("pinging all candidates")
|
||||
s.agent.pingAllCandidates()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user