add set_target_window_size methods to Server and Client (#149)

Closes #101
This commit is contained in:
Sean McArthur
2017-10-13 11:19:56 -07:00
committed by GitHub
parent 2fcf8c3740
commit 5c1bde7d62
10 changed files with 347 additions and 33 deletions

View File

@@ -6,7 +6,7 @@ use proto::*;
use bytes::Buf;
use std::io;
use std::{cmp, io};
/// Manages state transitions related to outbound frames.
#[derive(Debug)]
@@ -144,7 +144,7 @@ where
// Reclaim all capacity assigned to the stream and re-assign it to the
// connection
let available = stream.send_flow.available();
let available = stream.send_flow.available().as_size();
stream.send_flow.claim_capacity(available);
let frame = frame::Reset::new(stream.id, reason);
@@ -224,7 +224,7 @@ where
/// Current available stream send capacity
pub fn capacity(&self, stream: &mut store::Ptr<B, P>) -> WindowSize {
let available = stream.send_flow.available();
let available = stream.send_flow.available().as_size();
let buffered = stream.buffered_send_data;
if available <= buffered {
@@ -265,7 +265,7 @@ where
// Reclaim all capacity assigned to the stream and re-assign it to the
// connection
let available = stream.send_flow.available();
let available = stream.send_flow.available().as_size();
stream.send_flow.claim_capacity(available);
// Re-assign all capacity to the connection
self.prioritize
@@ -308,6 +308,10 @@ where
let stream = &mut *stream;
stream.send_flow.dec_window(dec);
let available = stream.send_flow.available().as_size();
stream.send_flow.claim_capacity(cmp::min(dec, available));
trace!(
"decremented stream window; id={:?}; decr={}; flow={:?}",
stream.id,