aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/libp2p/mod.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-01 13:30:12 +0100
committertv <tv@krebsco.de>2026-11-01 13:30:12 +0100
commit7a6eda9ca3abcb64bd41a6b85ea56a5b3f8b0b51 (patch)
tree7b95ad34c96da254a3672ba680e81df0280805af /src/transport/libp2p/mod.rs
parentfec2900523cba5a70b7f0f67f2b132c7a655a926 (diff)
libp2p: one Book::usable for all dials
Diffstat (limited to 'src/transport/libp2p/mod.rs')
-rw-r--r--src/transport/libp2p/mod.rs12
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 {