perf/basic_host: Don't handle address change if we hasn't anyone
@@ -520,8 +520,11 @@ func (h *BasicHost) background() {
defer ticker.Stop()
for {
+ var curr []ma.Multiaddr
+ if len(h.network.ListenAddresses()) > 0 {
h.updateLocalIpAddr()
- curr := h.Addrs()
+ curr = h.Addrs()
+ }
emitAddrChange(curr, lastAddrs)
lastAddrs = curr
