From 2f0d1d4bcb44c7a10af77c3e46739f23c64968f3 Mon Sep 17 00:00:00 2001 From: soul-probe Date: Wed, 30 Sep 2026 02:14:27 +0200 Subject: [PATCH] Odin test: the lingering-publisher test admits until 64 are held, then refuses one A peer that times out on a loaded host no longer changes the count, and the six refused peers no longer wait out their deadline while the first sessions idle out. Co-Authored-By: Claude Sonnet 5.5 --- crates/odin-daemon/src/main.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/crates/odin-daemon/src/main.rs b/crates/odin-daemon/src/main.rs index 6f6e20b..5665fe1 100644 --- a/crates/odin-daemon/src/main.rs +++ b/crates/odin-daemon/src/main.rs @@ -1870,12 +1870,24 @@ mod tests { fn self_presence_lands_while_lingering_publishers_hold_every_session() -> Result<()> { let mut odin = activated_odin()?; let target = odin.server.local_addr()?; - let admitted = odin.serve_while(move || { - (0..70) - .filter(|index| lingering_peer(target, PEER_CONNECTION_BASE + index, None).is_ok()) - .count() + // Peers arrive until 64 are admitted, then one more is refused. A peer + // that times out under load is retried as a new one: the property is a + // full table, not that no packet is ever late. Refused peers wait out + // their whole connect deadline, so only one is tried, or the first + // sessions would idle out before the heartbeats are taken. + let (admitted, overflow_admitted) = odin.serve_while(move || { + let (mut admitted, mut next) = (0, 0); + while admitted < 64 && next < 96 { + if lingering_peer(target, PEER_CONNECTION_BASE + next, None).is_ok() { + admitted += 1; + } + next += 1; + } + let overflow = lingering_peer(target, PEER_CONNECTION_BASE + next, None).is_ok(); + (admitted, overflow) })?; assert_eq!(admitted, 64, "the default session table is 64 wide"); + assert!(!overflow_admitted, "the 65th publisher is refused"); assert_eq!(odin.server.session_count(), 64, "the table is full"); // The first timed pass, with the table already full, publishes once.