Add test that a window update can be received in reserved state (#195)

This commit is contained in:
Sean McArthur
2017-12-19 20:07:39 -08:00
committed by Carl Lerche
parent 4cc573fa89
commit 10d8ed7429
4 changed files with 68 additions and 0 deletions

View File

@@ -238,6 +238,11 @@ impl Prioritize {
stream.send_flow
);
if stream.state.is_send_closed() && stream.buffered_send_data == 0 {
// We can't send any data, so don't bother doing anything else.
return Ok(());
}
// Update the stream level flow control.
stream.send_flow.inc_window(inc)?;

View File

@@ -745,6 +745,10 @@ impl Recv {
if !stream.state.is_recv_streaming() {
// No need to send window updates on the stream if the stream is
// no longer receiving data.
//
// TODO: is this correct? We could possibly send a window
// update on a ReservedRemote stream if we already know
// we want to stream the data faster...
continue;
}

View File

@@ -361,6 +361,13 @@ impl State {
}
}
pub fn is_send_closed(&self) -> bool {
match self.inner {
Closed(..) | HalfClosedLocal(..) | ReservedRemote => true,
_ => false,
}
}
pub fn is_idle(&self) -> bool {
match self.inner {
Idle => true,