Skip to content

Commit

Permalink
Remove pessimistic String calls for low level logs (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulwe authored Apr 21, 2024
1 parent c1b4386 commit a834f55
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ func (a *Agent) addCandidate(ctx context.Context, c Candidate, candidateConn net
set := a.localCandidates[c.NetworkType()]
for _, candidate := range set {
if candidate.Equal(c) {
a.log.Debugf("Ignore duplicate candidate: %s", c.String())
a.log.Debugf("Ignore duplicate candidate: %s", c)
if err := c.close(); err != nil {
a.log.Warnf("Failed to close duplicate candidate: %v", err)
}
Expand Down Expand Up @@ -886,7 +886,7 @@ func (a *Agent) findRemoteCandidate(networkType NetworkType, addr net.Addr) Cand
}

func (a *Agent) sendBindingRequest(m *stun.Message, local, remote Candidate) {
a.log.Tracef("Ping STUN from %s to %s", local.String(), remote.String())
a.log.Tracef("Ping STUN from %s to %s", local, remote)

a.invalidatePendingBindingRequests(time.Now())
a.pendingBindingRequests = append(a.pendingBindingRequests, bindingRequest{
Expand Down Expand Up @@ -1001,7 +1001,7 @@ 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))
a.log.Tracef("Inbound STUN (Request) from %s to %s, useCandidate: %v", remote, local, m.Contains(stun.AttrUseCandidate))

if err = stunx.AssertUsername(m, a.localUfrag+":"+a.remoteUfrag); err != nil {
a.log.Warnf("Discard message from (%s), %v", remote, err)
Expand Down

0 comments on commit a834f55

Please sign in to comment.