diff options
Diffstat (limited to 'src/transport')
| -rw-r--r-- | src/transport/libp2p/routes.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/transport/libp2p/routes.rs b/src/transport/libp2p/routes.rs index 05e14e8..3108f0c 100644 --- a/src/transport/libp2p/routes.rs +++ b/src/transport/libp2p/routes.rs @@ -42,7 +42,9 @@ pub(super) struct Routes { known: HashMap<IpRange, (bool, tokio::time::Instant)>, /// Whether there is a route to the internet, per family (IPv4, IPv6), as last /// asked (`internet`): own public addresses are published only then. True where - /// nobody asks (no `--libp2p-internet-hosts` of that family). + /// nobody asks (no `--libp2p-internet-hosts` of that family); false until the first + /// answer where someone does (resolving takes up to `RESOLVE_WITHIN`), so the first + /// member list entry doesn't list addresses nobody can reach. internet: [bool; 2], /// `--libp2p-internet-hosts`: names or addresses on the internet, whose routes /// tell whether there is one to the internet at all. @@ -74,7 +76,9 @@ fn range_of(ip: IpAddr) -> IpRange { impl Routes { /// With `--libp2p-internet-hosts` `internet_hosts`. pub(super) fn asking(internet_hosts: Vec<String>) -> Self { + let unknown = !internet_hosts.is_empty(); Self { + internet: [!unknown, !unknown], internet_hosts, ..Self::default() } |
