From fec2900523cba5a70b7f0f67f2b132c7a655a926 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 1 Nov 2026 13:29:34 +0100 Subject: libp2p: bump dupe grace period --- src/transport/libp2p/book.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/transport/libp2p/book.rs') 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, - /// 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, /// 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 { let mut connections: Vec<(bool, Duration, ConnectionId)> = self .connections -- cgit v1.3.1