Skip to content

Commit

Permalink
Aggressive nomination on binding response
Browse files Browse the repository at this point in the history
Add aggressive nomination when nominateOnBindingSuccess
  • Loading branch information
cnderrauber committed Dec 29, 2022
1 parent ea00dc7 commit 283943e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,11 @@ func (s *controlledSelector) HandleSuccessResponse(m *stun.Message, local, remot
p.state = CandidatePairStateSucceeded
s.log.Tracef("Found valid candidate pair: %s", p)
if p.nominateOnBindingSuccess {
if selectedPair := s.agent.getSelectedPair(); selectedPair == nil {
if selectedPair := s.agent.getSelectedPair(); selectedPair == nil ||
(selectedPair != p && selectedPair.priority() <= p.priority()) {
s.agent.setSelectedPair(p)
} else if selectedPair != p {
s.log.Tracef("ignore nominate new pair %s, already nominated pair %s", p, selectedPair)
}
}
}
Expand Down

0 comments on commit 283943e

Please sign in to comment.