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

fix: panic in pop_frame() #657

Merged
merged 1 commit into from Feb 13, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/proto/streams/flow_control.rs
Expand Up @@ -173,12 +173,15 @@ impl FlowControl {
self.available
);

// Ensure that the argument is correct
assert!(self.window_size >= sz as usize);

// Update values
self.window_size -= sz;
self.available -= sz;
// If send size is zero it's meaningless to update flow control window
seanmonstar marked this conversation as resolved.
Show resolved Hide resolved
if sz > 0 {
// Ensure that the argument is correct
assert!(self.window_size >= sz as usize);

// Update values
self.window_size -= sz;
self.available -= sz;
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/proto/streams/prioritize.rs
Expand Up @@ -744,6 +744,14 @@ impl Prioritize {
// capacity at this point.
debug_assert!(len <= self.flow.window_size());

// Check if the stream level window the peer knows is available. In some
// scenarios, maybe the window we know is available but the window which
// peer knows is not.
if len > 0 && len > stream.send_flow.window_size() {
stream.pending_send.push_front(buffer, frame.into());
continue;
}

tracing::trace!(len, "sending data frame");

// Update the flow control
Expand Down