From f0101f0ae2bc22174674bdf3f7de4e3b53dd42dc Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Sat, 6 Dec 2025 11:48:41 +0100 Subject: [PATCH] fix(proto): ensure ImmediateAcks are sent in Data space Closes https://github.com/n0-computer/quinn/issues/225 --- quinn-proto/src/connection/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index 3f2eca099..943c83664 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -1529,7 +1529,7 @@ impl Connection { self.stats.frame_tx.ping += 1; // If supported by the peer, we want no delays to the probe's ACK - if self.peer_supports_ack_frequency() { + if self.peer_supports_ack_frequency() && space_id == SpaceId::Data { trace!("IMMEDIATE_ACK"); builder .frame_space_mut() @@ -4233,7 +4233,9 @@ impl Connection { // so, but it still is something untidy. We should instead // suppress this when we know the remote is still validating the // path. - match self.peer_supports_ack_frequency() { + match self.peer_supports_ack_frequency() + && self.highest_space == SpaceId::Data + { true => self.immediate_ack(path_id), false => { self.ping_path(path_id).ok(); @@ -5058,6 +5060,11 @@ impl Connection { // IMMEDIATE_ACK if mem::replace(&mut space.for_path(path_id).immediate_ack_pending, false) { + debug_assert_eq!( + space_id, + SpaceId::Data, + "immediate acks must be sent in the data space" + ); trace!("IMMEDIATE_ACK"); buf.write(frame::FrameType::IMMEDIATE_ACK); sent.non_retransmits = true;