From 8e6c7d177e3003db8df5767ef8c3c092666dbc07 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 28 Nov 2026 10:38:57 +0100 Subject: [PATCH] cultnet-rs: test that a send queued behind a full window gets a pending receipt Co-Authored-By: Claude Sonnet 5.5 --- .../cultnet-rs/tests/rudp_connect_generation.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/cultnet-rs/tests/rudp_connect_generation.rs b/packages/cultnet-rs/tests/rudp_connect_generation.rs index 92f83322..86d4f4e8 100644 --- a/packages/cultnet-rs/tests/rudp_connect_generation.rs +++ b/packages/cultnet-rs/tests/rudp_connect_generation.rs @@ -1021,3 +1021,20 @@ fn the_hub_admits_a_pinned_client_that_restarts_on_the_same_address() -> Result< assert!(restarted.connected(), "the restarted pinned client was never admitted"); Ok(()) } + +/// A send that lands behind a full flow window is queued, not refused: it gets +/// a receipt for the sequence it was assigned, and the receipt reads Pending +/// while the packet is still queued. (Slow acknowledgements fill the window on +/// a loaded host; a silent peer fills it here without a clock.) +#[test] +fn a_send_queued_behind_a_full_window_returns_a_pending_receipt() -> Result<()> { + let server = socket()?; + let server_addr = server.local_addr()?; + let mut client = connected_client(&server, server_addr)?; + for _ in 0..CULTNET_RUDP_RELIABLE_SEND_WINDOW_PACKETS { + client.send_reliable("schema", b"fill".to_vec())?; + } + let receipt = client.send_reliable("schema", b"queued".to_vec())?; + assert_eq!(client.reliable_send_status(&receipt), CultNetRudpReliableSendStatus::Pending); + Ok(()) +}