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

[fix] the unit test gso_truncation #1853

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,7 @@ impl Connection {
"GSO truncated by demand for {} padding bytes",
segment_size - packet_len_unpadded
);
builder_storage = Some(builder);
break;
}

Expand Down
14 changes: 12 additions & 2 deletions quinn-proto/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3047,20 +3047,30 @@ fn datagram_gso() {
fn gso_truncation() {
let _guard = subscribe();
let mut pair = Pair::default();
let (client_ch, _) = pair.connect();
let (client_ch, server_ch) = pair.connect();

let initial_ios = pair.client_conn_mut(client_ch).stats().udp_tx.ios;

// Send three application datagrams such that each is large to be combined with another in a
// single MTU, and the second datagram would require an unreasonably large amount of padding to
// produce a QUIC packet of the same length as the first.
info!("sending");
for len in [1024, 768, 768] {
const SIZES: [usize; 3] = [1024, 768, 768];
for len in SIZES {
pair.client_datagrams(client_ch)
.send(vec![0; len].into(), false)
.unwrap();
}
pair.drive();
let final_ios = pair.client_conn_mut(client_ch).stats().udp_tx.ios;
assert_eq!(final_ios - initial_ios, 2);
for len in SIZES {
assert_eq!(
pair.server_datagrams(server_ch)
.recv()
.expect("datagram lost")
.len(),
len
);
}
}