diff options
| author | tv <tv@krebsco.de> | 2026-11-01 13:29:34 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-01 13:29:34 +0100 |
| commit | fec2900523cba5a70b7f0f67f2b132c7a655a926 (patch) | |
| tree | 60f2a4e0ab6dbafe572154dc1cd1cd9ebfd1cc7a /src/transport/libp2p/book.rs | |
| parent | 497eab7136b9d35101f4a5ffa81797efb85da390 (diff) | |
libp2p: bump dupe grace period
Diffstat (limited to 'src/transport/libp2p/book.rs')
| -rw-r--r-- | src/transport/libp2p/book.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/transport/libp2p/book.rs b/src/transport/libp2p/book.rs index e502bf8..087cd17 100644 --- a/src/transport/libp2p/book.rs +++ b/src/transport/libp2p/book.rs @@ -81,7 +81,8 @@ pub(super) struct Book { /// Peers connected only through a relay, dialled directly (`upgrade`): when to again /// at the soonest, and how long to wait after that. pub(super) upgrades: HashMap<PeerId, (tokio::time::Instant, Duration)>, - /// The shortest round trip measured on each open connection (libp2p's ping). + /// The shortest round trip measured on each open connection (libp2p's ping), since + /// the last connection to the same peer opened (they are compared then). pub(super) rtts: HashMap<ConnectionId, Duration>, /// Peers whose hole punching failed: how often in a row, and when to try again /// (`PUNCH_RETRIES`). @@ -137,8 +138,9 @@ impl Book { } /// The connections to `peer`, the one to keep first: direct ones before relayed - /// ones, measured ones by their round trip (`rtts`: over the LAN before a VPN's hub, - /// whichever opened first), then the oldest. + /// ones, measured ones by their round trip (`rtts`, the shortest since the last of + /// them opened: over the LAN before a VPN's hub, whichever opened first), then the + /// oldest. pub(super) fn ranked(&self, peer: &PeerId) -> Vec<ConnectionId> { let mut connections: Vec<(bool, Duration, ConnectionId)> = self .connections |
