Skip to content

Commit

Permalink
faster ice conn & update selected candidate pair
Browse files Browse the repository at this point in the history
when network updated
  • Loading branch information
cnderrauber committed Jul 9, 2021
1 parent 2eafed3 commit e38a987
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,26 @@ func (s *liteSelector) ContactCandidates() {
v.agent.validateSelectedPair()
}
}

// 从controlledSelector复制过来的,去掉了ping,增加ice重连
func (s *liteSelector) HandleBindingRequest(m *stun.Message, local, remote Candidate) {
v, ok := s.pairCandidateSelector.(*controlledSelector)
if !ok {
return
}

p := v.agent.findPair(local, remote)
if p == nil {
p = v.agent.addPair(local, remote)
}

useCandidate := m.Contains(stun.AttrUseCandidate)
if useCandidate {
if selectedPair := v.agent.getSelectedPair(); selectedPair != p {
v.agent.setSelectedPair(p)
}
v.agent.sendBindingSuccess(m, local, remote)
} else {
v.agent.sendBindingSuccess(m, local, remote)
}
}

0 comments on commit e38a987

Please sign in to comment.