Struct h2::proto::streams::flow_control::FlowControl
source · pub struct FlowControl {
window_size: Window,
available: Window,
}
Fields§
§window_size: Window
Window the peer knows about.
This can go negative if a SETTINGS_INITIAL_WINDOW_SIZE is received.
For example, say the peer sends a request and uses 32kb of the window. We send a SETTINGS_INITIAL_WINDOW_SIZE of 16kb. The peer has to adjust its understanding of the capacity of the window, and that would be:
default (64kb) - used (32kb) - settings_diff (64kb - 16kb): -16kb
available: Window
Window that we know about.
This can go negative if a user declares a smaller target window than the peer knows about.
Implementations§
source§impl FlowControl
impl FlowControl
pub fn new() -> FlowControl
sourcepub fn window_size(&self) -> u32
pub fn window_size(&self) -> u32
Returns the window size as known by the peer
Returns true if there is unavailable window capacity
pub fn claim_capacity(&mut self, capacity: u32) -> Result<(), Reason>
pub fn assign_capacity(&mut self, capacity: u32) -> Result<(), Reason>
sourcepub fn unclaimed_capacity(&self) -> Option<u32>
pub fn unclaimed_capacity(&self) -> Option<u32>
If a WINDOW_UPDATE frame should be sent, returns a positive number representing the increment to be used.
If there is no available bytes to be reclaimed, or the number of
available bytes does not reach the threshold, this returns None
.
This represents pending outbound WINDOW_UPDATE frames.
sourcepub fn inc_window(&mut self, sz: u32) -> Result<(), Reason>
pub fn inc_window(&mut self, sz: u32) -> Result<(), Reason>
Increase the window size.
This is called after receiving a WINDOW_UPDATE frame
sourcepub fn dec_send_window(&mut self, sz: u32) -> Result<(), Reason>
pub fn dec_send_window(&mut self, sz: u32) -> Result<(), Reason>
Decrement the send-side window size.
This is called after receiving a SETTINGS frame with a lower INITIAL_WINDOW_SIZE value.
Trait Implementations§
source§impl Clone for FlowControl
impl Clone for FlowControl
source§fn clone(&self) -> FlowControl
fn clone(&self) -> FlowControl
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more