Skip to content

Commit

Permalink
Trace log inbound messages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
boks1971 committed Jan 11, 2024
1 parent df552cd commit f1d4028
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,8 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)

a.selector.HandleSuccessResponse(m, local, remoteCandidate, remote)
} else if m.Type.Class == stun.ClassRequest {
a.log.Tracef("Inbound STUN (Request) from %s to %s, useCandidate: %v", remote.String(), local.String(), m.Contains(stun.AttrUseCandidate))

Check warning on line 1100 in agent.go

View check run for this annotation

Codecov / codecov/patch

agent.go#L1099-L1100

Added lines #L1099 - L1100 were not covered by tests
if err = stunx.AssertUsername(m, a.localUfrag+":"+a.remoteUfrag); err != nil {
a.log.Warnf("Discard message from (%s), %v", remote, err)
return
Expand Down Expand Up @@ -1131,8 +1133,6 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)
a.addRemoteCandidate(remoteCandidate)
}

a.log.Tracef("Inbound STUN (Request) from %s to %s", remote.String(), local.String())

a.selector.HandleBindingRequest(m, local, remoteCandidate)
}

Expand Down
4 changes: 2 additions & 2 deletions candidatepair.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ func (p *CandidatePair) String() string {
return ""
}

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

Check warning on line 39 in candidatepair.go

View check run for this annotation

Codecov / codecov/patch

candidatepair.go#L38-L39

Added lines #L38 - L39 were not covered by tests
}

func (p *CandidatePair) equal(other *CandidatePair) bool {
Expand Down

0 comments on commit f1d4028

Please sign in to comment.