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 committed Jun 4, 2021
1 parent f0d89c2 commit 7bf5934
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions p2p/host/basic/basic_host.go
Original file line number Diff line number Diff line change
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 7bf5934

Please sign in to comment.