Add nominated flag to candidate pair stats

This way we can identify, between the valid candidate, which one has
been nominated.
This commit is contained in:
Hugo Arregui
2019-06-28 04:05:21 +00:00
committed by Hugo Arregui
parent 77a03cd608
commit d2d97a6293
3 changed files with 4 additions and 1 deletions
+2 -1
View File
@@ -457,6 +457,7 @@ func (a *Agent) setSelectedPair(p *candidatePair) {
a.onSelectedCandidatePairChange(p)
a.selectedPair = p
a.selectedPair.nominated = true
a.updateConnectionState(ConnectionStateConnected)
// Close mDNS Conn. We don't need to do anymore querying
@@ -993,7 +994,7 @@ func (a *Agent) GetCandidatePairsStats() []CandidatePairStats {
LocalCandidateID: cp.local.ID(),
RemoteCandidateID: cp.remote.ID(),
State: cp.state,
// Nominated bool
Nominated: cp.nominated,
// PacketsSent uint32
// PacketsReceived uint32
// BytesSent uint64
+1
View File
@@ -22,6 +22,7 @@ type candidatePair struct {
local Candidate
bindingRequestCount uint16
state CandidatePairState
nominated bool
}
func (p *candidatePair) String() string {
+1
View File
@@ -82,6 +82,7 @@ func (s *controllingSelector) ContactCandidates() {
p := s.agent.getBestValidCandidatePair()
if p != nil && s.isNominatable(p.local) && s.isNominatable(p.remote) {
s.log.Tracef("Nominatable pair found, nominating (%s, %s)", p.local.String(), p.remote.String())
p.nominated = true
s.nominatedPair = p
s.nominatePair(p)
return