Browse Source

Updates due to code review

pull/412/head
Can ZHANG 6 years ago
parent
commit
e6b1e07f11
  1. 5
      p2p/host/basic/basic_host.go

5
p2p/host/basic/basic_host.go

@ -474,10 +474,11 @@ func mergeAddrs(addrLists ...[]ma.Multiaddr) (uniqueAddrs []ma.Multiaddr) {
exists := make(map[string]bool)
for _, addrList := range addrLists {
for _, addr := range addrList {
if exists[addr.String()] {
k := string(addr.Bytes())
if exists[k] {
continue
}
exists[addr.String()] = true
exists[k] = true
uniqueAddrs = append(uniqueAddrs, addr)
}
}

Loading…
Cancel
Save