diff options
| author | tv <tv@krebsco.de> | 2026-11-01 13:30:12 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-01 13:30:12 +0100 |
| commit | 53d132ff902ff07198b0e01f8c1a030f06aa562b (patch) | |
| tree | 3c964e657a3044438295fe85f4e3c50f1a3acab5 /src/transport/libp2p/mod.rs | |
| parent | 400c4e845998101b94780b101a400c04d38897da (diff) | |
libp2p: one Book::usable for all dials
Diffstat (limited to 'src/transport/libp2p/mod.rs')
| -rw-r--r-- | src/transport/libp2p/mod.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/transport/libp2p/mod.rs b/src/transport/libp2p/mod.rs index 6c57867..6fea05a 100644 --- a/src/transport/libp2p/mod.rs +++ b/src/transport/libp2p/mod.rs @@ -49,8 +49,9 @@ //! it can be dialled, it lets the relays it picked go. //! //! With `--libp2p-ignore`, address ranges are left out (VPNs): not published, not told -//! peers by identify (`Identifying`), not offered for hole punching, not dialled, and -//! connections there refused (`Ignoring`). Ranges this node has no route to are left +//! peers by identify (`Identifying`), not offered for hole punching, not dialled by us +//! (`Book::usable`) nor by libp2p unless with an address elsewhere too, and connections +//! there refused (`Ignoring`). Ranges this node has no route to are left //! out alike, as long as it has none (`routes`): without IPv6 to the internet, peers' //! public IPv6 addresses; and with `--libp2p-internet-hosts`, its own aren't published //! then. With `--libp2p-prefer`, @@ -302,12 +303,7 @@ impl Libp2pTransport { async fn connect(&self, peer: PeerId) -> Result<()> { let addresses = { let mut book = lock(&self.book); - let mut known = book - .addresses - .get(&peer) - .map(|known| dialable(known, self.peer_id)) - .unwrap_or_default(); - known.retain(|address| !book.left_out(address)); + let known = book.usable(&peer, self.peer_id); if known.is_empty() { book.through_relays(peer, self.peer_id) } else { |
