From f640d2dad42e8a2b39481d281ab42e46b83aabfe Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Wed, 12 Apr 2023 11:09:48 -0700 Subject: [PATCH] Assume input is deduped --- p2p/host/basic/basic_host.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index e498dd22e2..ce82ad331d 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -1006,9 +1006,10 @@ func (h *BasicHost) AllAddrs() []ma.Multiaddr { } finalAddrs = append(finalAddrs, observedAddrs...) } + finalAddrs = dedupAddrs(finalAddrs) finalAddrs = inferWebtransportAddrsFromQuic(finalAddrs) - return dedupAddrs(finalAddrs) + return finalAddrs } var wtComponent = ma.StringCast("/webtransport") @@ -1018,6 +1019,7 @@ var wtComponent = ma.StringCast("/webtransport") // If we see that we are listening on the same port for QUIC and WebTransport, // we can be pretty sure that the WebTransport addr will be reachable if the // QUIC one is. +// We assume the input is deduped. func inferWebtransportAddrsFromQuic(in []ma.Multiaddr) []ma.Multiaddr { // We need to check if we are listening on the same ip+port for QUIC and WebTransport. // If not, there's nothing to do since we can't infer anything.