Limit send flow control bug to window_size (#78)
Senders could set the available capacity greater than the current `window_size`. This caused a panic when the sender attempted to send more than the receiver could accept.
This commit is contained in:
committed by
Oliver Gould
parent
9448a19408
commit
93925e6d1f
@@ -246,7 +246,8 @@ impl<B, P> Prioritize<B, P>
|
||||
// Don't assign more than the window has available!
|
||||
let additional = cmp::min(
|
||||
total_requested - stream.send_flow.available(),
|
||||
stream.send_flow.window_size());
|
||||
// Can't assign more than what is available
|
||||
stream.send_flow.window_size() - stream.send_flow.available());
|
||||
|
||||
trace!("try_assign_capacity; requested={}; additional={}; buffered={}; window={}; conn={}",
|
||||
total_requested,
|
||||
@@ -451,8 +452,6 @@ impl<B, P> Prioritize<B, P>
|
||||
Frame::Data(mut frame) => {
|
||||
// Get the amount of capacity remaining for stream's
|
||||
// window.
|
||||
//
|
||||
// TODO: Is this the right thing to check?
|
||||
let stream_capacity = stream.send_flow.available();
|
||||
let sz = frame.payload().remaining();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user