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

Clarify Connection::space_can_send logic #1851

Merged
merged 5 commits into from
May 12, 2024
Merged
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
32 changes: 9 additions & 23 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,33 +1028,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() {
let can_send = self.spaces[space_id].can_send(&self.streams);
if !can_send.is_empty() {
return can_send;
}
}

if space_id != SpaceId::Data {
if self.spaces[space_id].crypto.is_none()
&& (space_id != SpaceId::Data
|| self.zero_rtt_crypto.is_none()
|| self.side.is_server())
{
// No keys available for this space
return SendableFrames::empty();
}

if self.spaces[space_id].crypto.is_some() && self.can_send_1rtt(frame_space_1rtt) {
return SendableFrames {
other: true,
acks: false,
};
}

if self.zero_rtt_crypto.is_some() && self.side.is_client() {
let mut can_send = self.spaces[space_id].can_send(&self.streams);
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() {
Ralith marked this conversation as resolved.
Show resolved Hide resolved
return can_send;
}
}

SendableFrames::empty()
can_send
}

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