Browse Source

don't drop ephemeral ports in address set clean up

pull/598/head
vyzo 6 years ago
parent
commit
45d2888617
  1. 7
      p2p/host/relay/autorelay.go

7
p2p/host/relay/autorelay.go

@ -286,7 +286,6 @@ func (ar *AutoRelay) doUpdateAddrs() {
// addrsplosion. For the latter, we use the following heuristic:
// - if the address set includes a (tcp) address with the default port 4001,
// we remove all tcp addrs with a different port
// - Otherwise we remove all addrs with ephemeral ports (>= 32768)
func cleanupAddressSet(pi pstore.PeerInfo) pstore.PeerInfo {
// pass-1: find default port
has4001 := false
@ -313,9 +312,9 @@ func cleanupAddressSet(pi pstore.PeerInfo) pstore.PeerInfo {
continue
}
port, err := tcpPort(addr)
if err == nil {
if (has4001 && port != 4001) || port >= 32768 {
if has4001 {
port, err := tcpPort(addr)
if err == nil && port != 4001 {
continue
}
}

Loading…
Cancel
Save