diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index 9ba5446cc..69b3eaae5 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -1488,6 +1488,8 @@ impl Connection { // Send MTU probe if necessary if transmit.is_empty() && self.state.is_established() { + // MTU probing happens only in Data space. + let space_id = SpaceId::Data; path_id = *self.paths.first_key_value().expect("one path must exist").0; let probe_data = loop { // We MTU probe all paths for which all of the following is true: @@ -1501,9 +1503,7 @@ impl Connection { && !self.abandoned_paths.contains(&path_id); let probe_size = eligible .then(|| { - let next_pn = self.spaces[SpaceId::Data] - .for_path(path_id) - .peek_tx_number(); + let next_pn = self.spaces[space_id].for_path(path_id).peek_tx_number(); self.path_data_mut(path_id).mtud.poll_transmit(now, next_pn) }) .flatten(); @@ -5089,6 +5089,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; @@ -5882,6 +5887,11 @@ impl Connection { /// According to the spec, this will result in an error if the remote endpoint does not support /// the Acknowledgement Frequency extension pub(crate) fn immediate_ack(&mut self, path_id: PathId) { + debug_assert_eq!( + self.highest_space, + SpaceId::Data, + "immediate ack must be written in the data space" + ); self.spaces[self.highest_space] .for_path(path_id) .immediate_ack_pending = true;