aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport/libp2p/tests.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-01 05:13:59 +0100
committertv <tv@krebsco.de>2026-11-01 05:13:59 +0100
commit024458e67a4cb6f29bf1ff346c9f953781006129 (patch)
treedf88c9246534a891ef43c09cb83bcc9335a40cf6 /src/transport/libp2p/tests.rs
parent0a78f9223668831b0887bfead978017574764bd9 (diff)
libp2p: introduce rehoming
Diffstat (limited to 'src/transport/libp2p/tests.rs')
-rw-r--r--src/transport/libp2p/tests.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/transport/libp2p/tests.rs b/src/transport/libp2p/tests.rs
index ed23b34..7311ebf 100644
--- a/src/transport/libp2p/tests.rs
+++ b/src/transport/libp2p/tests.rs
@@ -898,20 +898,20 @@ fn a_direct_connection_wins_over_a_relayed_one() {
// Of several, the oldest direct one stays; a relayed one only without a direct.
connect(&mut book, both, false);
assert_eq!(
- book.duplicates(&both, false),
+ book.duplicates(&both),
[
ConnectionId::new_unchecked(4),
ConnectionId::new_unchecked(2)
]
);
- assert!(book.duplicates(&relayed_only, false).is_empty());
- // Not while one of them carries a slot, ours or the peer's, or we reserve one.
- assert!(book.duplicates(&both, true).is_empty());
+ assert!(book.duplicates(&relayed_only).is_empty());
+ // Also where one of them carries a slot, ours or the peer's: messages would go over
+ // either.
book.slots.insert(both);
- assert!(book.duplicates(&both, false).is_empty());
+ assert_eq!(book.duplicates(&both).len(), 2);
book.slots.clear();
book.slots_here.insert(both);
- assert!(book.duplicates(&both, false).is_empty());
+ assert_eq!(book.duplicates(&both).len(), 2);
book.slots_here.clear();
// Once measured, the fastest direct one stays, however young.
book.rtts
@@ -919,7 +919,7 @@ fn a_direct_connection_wins_over_a_relayed_one() {
book.rtts
.insert(ConnectionId::new_unchecked(4), Duration::from_millis(2));
assert_eq!(
- book.duplicates(&both, false),
+ book.duplicates(&both),
[
ConnectionId::new_unchecked(3),
ConnectionId::new_unchecked(2)