Skip to content

Commit

Permalink
perf/basic_host: Don't handle address change if we hasn't anyone
Browse files Browse the repository at this point in the history
  • Loading branch information
snyh authored and Stebalien committed Jun 30, 2021
1 parent 8ec1eec commit cc409ae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions p2p/host/basic/basic_host.go
Expand Up @@ -520,8 +520,11 @@ func (h *BasicHost) background() {
defer ticker.Stop()

for {
h.updateLocalIpAddr()
curr := h.Addrs()
var curr []ma.Multiaddr
if len(h.network.ListenAddresses()) > 0 {
h.updateLocalIpAddr()
curr = h.Addrs()
}
emitAddrChange(curr, lastAddrs)
lastAddrs = curr

Expand Down

0 comments on commit cc409ae

Please sign in to comment.