From c6d945f65e52b23ba897704673c065ef2598bd8b Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Sat, 27 Jun 2020 14:44:16 -0700 Subject: [PATCH] Remove nominationRequestCount Before then nominating a candidate pair we limited the amount of requests we sent, and would set the connection to failed. This change removes that limit, and instead uses the Disconnected+Failed timer to control this. I found this when debugging an unrelated thing, and was surprised by the behavior. I didn't find anything in the spec that mentioned this, and isn't a knob that users will understand how to control easily. --- selection.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/selection.go b/selection.go index 08a070e..7f93781 100644 --- a/selection.go +++ b/selection.go @@ -17,17 +17,15 @@ type pairCandidateSelector interface { } type controllingSelector struct { - startTime time.Time - agent *Agent - nominatedPair *candidatePair - nominationRequestCount uint16 - log logging.LeveledLogger + startTime time.Time + agent *Agent + nominatedPair *candidatePair + log logging.LeveledLogger } func (s *controllingSelector) Start() { s.startTime = time.Now() s.nominatedPair = nil - s.nominationRequestCount = 0 } func (s *controllingSelector) isNominatable(c Candidate) bool { @@ -54,11 +52,6 @@ func (s *controllingSelector) ContactCandidates() { s.agent.checkKeepalive() } case s.nominatedPair != nil: - if s.nominationRequestCount > s.agent.maxBindingRequests { - s.log.Trace("max nomination requests reached, setting the connection state to failed") - s.agent.updateConnectionState(ConnectionStateFailed) - return - } s.nominatePair(s.nominatedPair) default: p := s.agent.getBestValidCandidatePair() @@ -94,7 +87,6 @@ func (s *controllingSelector) nominatePair(pair *candidatePair) { s.log.Tracef("ping STUN (nominate candidate pair) from %s to %s\n", pair.local.String(), pair.remote.String()) s.agent.sendBindingRequest(msg, pair.local, pair.remote) - s.nominationRequestCount++ } func (s *controllingSelector) HandleBindingRequest(m *stun.Message, local, remote Candidate) {