Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test voluntary acks when sending max-size datagrams #1856

Merged
merged 1 commit into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions quinn-proto/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3103,3 +3103,33 @@ fn large_datagram_with_acks() {
assert_eq!(pair.server_datagrams(server_ch).recv().unwrap(), msg);
assert_eq!(final_datagrams - initial_datagrams, 2);
}

/// Verify that an ACK prompted by receipt of many non-ACK-eliciting packets is sent alongside
/// outgoing application datagrams too large to coexist in the same packet with it.
#[test]
fn voluntary_ack_with_large_datagrams() {
let _guard = subscribe();
let mut pair = Pair::default();
let (client_ch, _) = pair.connect();

// Prompt many large ACKs from the server
let initial_datagrams = pair.client_conn_mut(client_ch).stats().udp_tx.datagrams;
// Send enough packets that we're confident some packet numbers will be skipped, ensuring that
// larger ACKs occur
const COUNT: usize = 256;
for _ in 0..COUNT {
let max_size = pair.client_datagrams(client_ch).max_size().unwrap();
pair.client_datagrams(client_ch)
.send(vec![0; max_size].into(), true)
.unwrap();
pair.drive();
}
let final_datagrams = pair.client_conn_mut(client_ch).stats().udp_tx.datagrams;
// Failure may indicate `max_size` is too small and ACKs are reliably being packed into the same
// datagram, which is reasonable behavior but makes this test ineffective.
assert_ne!(
final_datagrams - initial_datagrams,
COUNT as u64,
"client should have sent some ACK-only packets"
);
}