Skip to content

Commit

Permalink
Invert condition to reduce rightward drift
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed May 8, 2024
1 parent 2fc06cc commit b007489
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1011,21 +1011,19 @@ impl Connection {

/// Indicate what types of frames are ready to send for the given space
fn space_can_send(&self, space_id: SpaceId, frame_space_1rtt: usize) -> SendableFrames {
if self.spaces[space_id].crypto.is_some()
|| (space_id == SpaceId::Data
&& self.zero_rtt_crypto.is_some()
&& self.side.is_client())
if self.spaces[space_id].crypto.is_none()
&& (space_id != SpaceId::Data
|| self.zero_rtt_crypto.is_none()
|| self.side.is_server())
{
let mut can_send = self.spaces[space_id].can_send(&self.streams);
if space_id == SpaceId::Data {
can_send.other |= self.can_send_1rtt(frame_space_1rtt);
}
if !can_send.is_empty() {
return can_send;
}
// No keys available for this space
return SendableFrames::empty();
}

SendableFrames::empty()
let mut can_send = self.spaces[space_id].can_send(&self.streams);
if space_id == SpaceId::Data {
can_send.other |= self.can_send_1rtt(frame_space_1rtt);
}
can_send
}

/// Process `ConnectionEvent`s generated by the associated `Endpoint`
Expand Down

0 comments on commit b007489

Please sign in to comment.