Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUSTTOOLCHAIN }}
toolchain: nightly-2026-08-11
components: rustfmt

- name: Run cargo fmt - quiche
Expand Down
13 changes: 11 additions & 2 deletions quiche/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8234,8 +8234,17 @@ impl<F: BufFactory> Connection<F> {
continue;
}

// We are ready to send data for this packet number space.
if crypto_ctx.data_available() || pkt_space.ready() {
if pkt_space.ready() {
return Ok(Type::from_epoch(epoch));
}

// Pending recovery cannot send CRYPTO or PING while closing.
// Preserve a queued ACK, then let the application close through.
if self.local_error.is_some() && self.is_established() {
continue;
}

if crypto_ctx.data_available() {
return Ok(Type::from_epoch(epoch));
}

Expand Down
57 changes: 57 additions & 0 deletions quiche/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8832,6 +8832,63 @@ fn app_close_by_client(
);
}

#[rstest]
fn app_close_with_pending_handshake_probe(
#[values("cubic", "bbr2_gcongestion")] cc_algorithm_name: &str,
#[values(false, true)] close_server: bool,
) {
let mut pipe = test_utils::Pipe::new(cc_algorithm_name).unwrap();
let flight = test_utils::emit_flight(&mut pipe.client).unwrap();
test_utils::process_flight(&mut pipe.server, flight).unwrap();
let flight = test_utils::emit_flight(&mut pipe.server).unwrap();
test_utils::process_flight(&mut pipe.client, flight).unwrap();
let flight = test_utils::emit_flight(&mut pipe.client).unwrap();
test_utils::process_flight(&mut pipe.server, flight).unwrap();
assert!(pipe.client.is_established() && pipe.server.is_established());
assert!(!pipe.client.handshake_confirmed);

let (conn, peer) = if close_server {
(&mut pipe.server, &mut pipe.client)
} else {
(&mut pipe.client, &mut pipe.server)
};
conn.paths
.get_active_mut()
.unwrap()
.recovery
.inc_loss_probes(packet::Epoch::Handshake);
conn.close(true, 123, b"closing").unwrap();
let mut buf = [0; 1200];
for _ in 0..4 {
match conn.send(&mut buf) {
Ok((len, info)) => {
peer.recv(&mut buf[..len], RecvInfo {
from: info.from,
to: info.to,
})
.unwrap();
},
Err(Error::Done) => (),
Err(error) => panic!("close send failed: {error:?}"),
}
if conn.is_draining() {
break;
}
}
assert!(
conn.is_draining(),
"handshake probe prevented application close"
);
assert_eq!(
peer.peer_error(),
Some(&ConnectionError {
is_app: true,
error_code: 123,
reason: b"closing".to_vec(),
})
);
}

#[rstest]
fn app_close_by_server_during_handshake_private_key_failure(
#[values("cubic", "bbr2_gcongestion")] cc_algorithm_name: &str,
Expand Down
Loading