Skip to content

Commit

Permalink
Remove pessimistic String calls for low level logs
Browse files Browse the repository at this point in the history
  • Loading branch information
paulwe committed May 1, 2024
1 parent 78a9ef9 commit b5f4ca0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions selection.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *controllingSelector) ContactCandidates() {
default:
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())
s.log.Tracef("Nominatable pair found, nominating (%s, %s)", p.Local, p.Remote)
p.nominated = true
s.nominatedPair = p
s.nominatePair(p)
Expand Down Expand Up @@ -87,7 +87,7 @@ func (s *controllingSelector) nominatePair(pair *CandidatePair) {
return
}

s.log.Tracef("Ping STUN (nominate candidate pair) from %s to %s", pair.Local.String(), pair.Remote.String())
s.log.Tracef("Ping STUN (nominate candidate pair) from %s to %s", pair.Local, pair.Remote)
s.agent.sendBindingRequest(msg, pair.Local, pair.Remote)
}

Expand All @@ -106,8 +106,7 @@ func (s *controllingSelector) HandleBindingRequest(m *stun.Message, local, remot
if bestPair == nil {
s.log.Tracef("No best pair available")
} else if bestPair.equal(p) && s.isNominatable(p.Local) && s.isNominatable(p.Remote) {
s.log.Tracef("The candidate (%s, %s) is the best candidate available, marking it as nominated",
p.Local.String(), p.Remote.String())
s.log.Tracef("The candidate (%s, %s) is the best candidate available, marking it as nominated", p.Local, p.Remote)
s.nominatedPair = p
s.nominatePair(p)
}
Expand All @@ -130,7 +129,7 @@ func (s *controllingSelector) HandleSuccessResponse(m *stun.Message, local, remo
return
}

s.log.Tracef("Inbound STUN (SuccessResponse) from %s to %s", remote.String(), local.String())
s.log.Tracef("Inbound STUN (SuccessResponse) from %s to %s", remote, local)
p := s.agent.findPair(local, remote)

if p == nil {
Expand Down Expand Up @@ -221,7 +220,7 @@ func (s *controlledSelector) HandleSuccessResponse(m *stun.Message, local, remot
return
}

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

p := s.agent.findPair(local, remote)
if p == nil {
Expand Down
2 changes: 1 addition & 1 deletion udp_mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func (m *UDPMuxDefault) connWorker() {
}

if destinationConn == nil {
m.params.Logger.Tracef("Dropping packet from %s, addr: %s", udpAddr.addr.String(), addr.String())
m.params.Logger.Tracef("Dropping packet from %s, addr: %s", udpAddr.addr, addr)
continue
}

Expand Down

0 comments on commit b5f4ca0

Please sign in to comment.