Fix send flow control bug

The send stream state is transitioned before data is buffered. As such,
the stream state could be closed while there is still data to be sent.
This commit is contained in:
Carl Lerche
2017-08-25 07:07:21 -07:00
parent 63ba0073a4
commit 0c8a94aa11
5 changed files with 20 additions and 23 deletions

View File

@@ -250,17 +250,21 @@ impl<B> Send<B> where B: Buf {
if val < old_val {
let dec = old_val - val;
trace!("decrementing all windows; dec={}", dec);
store.for_each(|mut stream| {
let stream = &mut *stream;
if stream.state.is_send_streaming() {
stream.send_flow.dec_window(dec);
stream.send_flow.dec_window(dec);
trace!("decremented stream window; id={:?}; decr={}; flow={:?}",
stream.id, dec, stream.send_flow);
// TODO: Handle reclaiming connection level window
// capacity.
// TODO: Probably try to assign capacity?
// TODO: Should this notify the producer?
}
// TODO: Handle reclaiming connection level window
// capacity.
// TODO: Should this notify the producer?
Ok(())
})?;