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 | 400c4e845998101b94780b101a400c04d38897da (patch) | |
| tree | 8b75886e6eff27c36932218ae63b8418bad65238 /src/transport/libp2p/book.rs | |
| parent | 12fbf8bf78408abbfde0ec1802f39307def4a0ee (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 |
