diff options
| author | tv <tv@krebsco.de> | 2026-11-01 05:13:59 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-01 05:13:59 +0100 |
| commit | 35eade856a9b445920ec07eacdeaf153239d8ec9 (patch) | |
| tree | 1d05ea121d1fc78265e9763979a3f7f3c15081f2 /src/transport/libp2p/mod.rs | |
| parent | ab880c042707877f2d5adb57a706cef59dee0810 (diff) | |
libp2p: introduce rehoming
Diffstat (limited to 'src/transport/libp2p/mod.rs')
| -rw-r--r-- | src/transport/libp2p/mod.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/transport/libp2p/mod.rs b/src/transport/libp2p/mod.rs index a4fefc3..9d1dcc7 100644 --- a/src/transport/libp2p/mod.rs +++ b/src/transport/libp2p/mod.rs @@ -32,11 +32,12 @@ //! all but one are closed a few seconds later (`DUPLICATE_GRACE`, `Book::duplicates`), //! by the side with the smaller peer ID: it keeps the direct one with the shortest round //! trip (libp2p's ping, on each connection), so a path over the LAN wins over one -//! through a VPN, whichever opened first. A peer connected directly is dialled again -//! where it might be reached better (`explore`): at addresses it tells of later (a new -//! interface: identify pushes them at once), and at all of them when this node gains -//! an interface. Otherwise a connection made over the WLAN would stay there once -//! ethernet comes. +//! through a VPN, whichever opened first; between a relay and a node with a slot on it +//! too, where a slot on a connection closed is reserved again over the one kept. A +//! peer connected directly is dialled again where it might be reached better +//! (`explore`): at addresses it tells of later (a new interface: identify pushes them +//! at once), and at all of them when this node gains an interface. Otherwise a +//! connection made over the WLAN would stay there once ethernet comes. //! //! A relay says so where it publishes its addresses: next to each, the same address //! ending in `/p2p-circuit` (where to reserve a slot), which other nodes find in the @@ -187,6 +188,9 @@ const DUPLICATE_GRACE: Duration = Duration::from_secs(10); /// a hole punch under way (`PUNCH_RETRIES`), which takes its tries (up to a QUIC /// handshake's 5 s each, three times) on that connection. const PUNCH_GRACE: Duration = Duration::from_secs(60); +/// A slot lost this soon after its relay's duplicate connections were closed moved to +/// the one kept (`Book::rehoming`). +const REHOMING_WITHIN: Duration = Duration::from_secs(10); /// After libp2p's hole punching gave up on a peer (three tries, as the relayed /// connection opened), it tries again after these, the last one over and over: what /// failed may have been passing (a NAT's mapping, a busy link). Each time through a new |
