8000 Trace log inbound messages (#641) · pion/ice@8c013b0 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

Commit 8c013b0

Browse files
committed
Trace log inbound messages (#641)
* Trace log inbound messages On an ICE restart in controlled mode, seeing incoming messages getting discarded to due to username mismatch. That is because the broswer is still using its old candidate and user name. As the controlled agent waits for `useCandidate` from the controlling agent, the controlled agent does not get to connected/nominated state inspite of getting several success responses. Suspect the controlling side does not have `useCandidate` for the new pair and it is still sending it for the old pair. Logging more details in trace to understand it better. * Fix test
1 parent c62fd28 commit 8c013b0

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

agent.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,8 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)
10961096

10971097
a.selector.HandleSuccessResponse(m, local, remoteCandidate, remote)
10981098
} else if m.Type.Class == stun.ClassRequest {
1099+
a.log.Tracef("Inbound STUN (Request) from %s to %s, useCandidate: %v", remote.String(), local.String(), m.Contains(stun.AttrUseCandidate))
1100+
10991101
if err = stunx.AssertUsername(m, a.localUfrag+":"+a.remoteUfrag); err != nil {
11001102
a.log.Warnf("Discard message from (%s), %v", remote, err)
11011103
return
@@ -1131,8 +1133,6 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)
11311133
a.addRemoteCandidate(remoteCandidate)
11321134
}
11331135

1134-
a.log.Tracef("Inbound STUN (Request) from %s to %s", remote.String(), local.String())
1135-
11361136
a.selector.HandleBindingRequest(m, local, remoteCandidate)
11371137
}
11381138

agent_get_best_valid_candidate_pair_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestAgentGetBestValidCandidatePair(t *testing.T) {
2323
candidatePair.state = CandidatePairStateSucceeded
2424

2525
actualBestPair := f.sut.getBestValidCandidatePair()
26-
expectedBestPair := &CandidatePair{Remote: remoteCandidate, Local: f.hostLocal}
26+
expectedBestPair := &CandidatePair{Remote: remoteCandidate, Local: f.hostLocal, state: CandidatePairStateSucceeded}
2727

2828
require.Equal(t, actualBestPair.String(), expectedBestPair.String())
2929
}

candidatepair.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func (p *CandidatePair) String() string {
3535
return ""
3636
}
3737

38-
return fmt.Sprintf("prio %d (local, prio %d) %s <-> %s (remote, prio %d)",
39-
p.priority(), p.Local.Priority(), p.Local, p.Remote, p.Remote.Priority())
38+
return fmt.Sprintf("prio %d (local, prio %d) %s <-> %s (remote, prio %d), state: %s, nominated: %v, nominateOnBindingSuccess: %v",
39+
p.priority(), p.Local.Priority(), p.Local, p.Remote, p.Remote.Priority(), p.state, p.nominated, p.nominateOnBindingSuccess)
4040
}
4141

4242
func (p *CandidatePair) equal(other *CandidatePair) bool {

0 commit comments

Comments
 (0)
0