Fix some flow control bugs

When a stream is closed, connection level capacity should be released
back to the connection and then assigned to other streams waiting for
capacity.
This commit is contained in:
Carl Lerche
2017-09-07 16:45:20 -07:00
parent 9b42dafd24
commit ae6bad6cef
4 changed files with 232 additions and 9 deletions

View File

@@ -86,8 +86,11 @@ where B: Buf,
-> Result<(), UserError>
{
trace!("send_headers; frame={:?}; init_window={:?}", frame, self.init_window_sz);
let end_stream = frame.is_end_stream();
// Update the state
stream.state.send_open(frame.is_end_stream())?;
stream.state.send_open(end_stream)?;
// Queue the frame for sending
self.prioritize.queue_frame(frame.into(), stream, task);
@@ -156,6 +159,9 @@ where B: Buf,
trace!("send_trailers -- queuing; frame={:?}", frame);
self.prioritize.queue_frame(frame.into(), stream, task);
// Release any excess capacity
self.prioritize.reserve_capacity(0, stream);
Ok(())
}