Immediately apply initial window size to streams

The initial window size should be applied to streams once they leave the
IDLE state.
This commit is contained in:
Carl Lerche
2017-08-24 11:03:33 -07:00
parent 66dbde92ef
commit 6a6c9665cd
6 changed files with 69 additions and 21 deletions

View File

@@ -47,6 +47,11 @@ impl<B> Send<B> where B: Buf {
}
}
/// Returns the initial send window size
pub fn init_window_sz(&self) -> WindowSize {
self.init_window_sz
}
pub fn poll_open_ready<P: Peer>(&mut self) -> Poll<(), ConnectionError> {
try!(self.ensure_can_open::<P>());
@@ -64,7 +69,7 @@ impl<B> Send<B> where B: Buf {
///
/// Returns the stream state if successful. `None` if refused
pub fn open<P: Peer>(&mut self)
-> Result<Stream<B>, ConnectionError>
-> Result<StreamId, ConnectionError>
{
try!(self.ensure_can_open::<P>());
@@ -74,7 +79,7 @@ impl<B> Send<B> where B: Buf {
}
}
let ret = Stream::new(self.next_stream_id);
let ret = self.next_stream_id;
// Increment the number of locally initiated streams
self.num_streams += 1;
@@ -93,10 +98,6 @@ impl<B> Send<B> where B: Buf {
// Update the state
stream.state.send_open(frame.is_end_stream())?;
if stream.state.is_send_streaming() {
stream.send_flow.inc_window(self.init_window_sz)?;
}
// Queue the frame for sending
self.prioritize.queue_frame(frame.into(), stream, task);