Trying to get something working

This commit is contained in:
Carl Lerche
2017-08-10 13:15:40 -07:00
parent 6c962491c6
commit a1b03b7724
7 changed files with 127 additions and 39 deletions

View File

@@ -79,6 +79,7 @@ impl<B> Send<B> where B: Buf {
stream: &mut store::Ptr<B>)
-> Result<(), ConnectionError>
{
trace!("send_headers; frame={:?}", frame);
// Update the state
stream.state.send_open(self.init_window_sz, frame.is_end_stream())?;
@@ -252,6 +253,26 @@ impl<B> Send<B> where B: Buf {
Ok(())
}
pub fn window_size(&mut self, stream: &mut Stream<B>) -> usize {
if let Some(flow) = stream.state.send_flow_control() {
// Track the current task
stream.send_task = Some(task::current());
// We are observing the window, so apply the pending updates
flow.apply_window_update();
let mut window = flow.effective_window_size();
if stream.unadvertised_send_window > window {
return 0;
}
return (window - stream.unadvertised_send_window) as usize;
}
0
}
pub fn dec_num_streams(&mut self) {
self.num_streams -= 1;
}