Struct libp2p::yamux::WindowUpdateMode
source · pub struct WindowUpdateMode(_);
Expand description
The window update mode determines when window updates are sent to the remote, giving it new credit to send more data.
Implementations§
source§impl WindowUpdateMode
impl WindowUpdateMode
sourcepub fn on_receive() -> WindowUpdateMode
pub fn on_receive() -> WindowUpdateMode
The window update mode whereby the remote is given new credit via a window update whenever the current receive window is exhausted when data is received, i.e. this mode cannot exert back-pressure from application code that is slow to read from a substream.
Note: The receive buffer may overflow with this strategy if the receiver is too slow in reading the data from the buffer. The maximum receive buffer size must be tuned appropriately for the desired throughput and level of tolerance for (temporarily) slow receivers.
sourcepub fn on_read() -> WindowUpdateMode
pub fn on_read() -> WindowUpdateMode
The window update mode whereby the remote is given new credit only when the current receive window is exhausted when data is read from the substream’s receive buffer, i.e. application code that is slow to read from a substream exerts back-pressure on the remote.
Note: If the receive window of a substream on both peers is exhausted and both peers are blocked on sending data before reading from the stream, a deadlock occurs. To avoid this situation, reading from a substream should never be blocked on writing to the same substream.
Note: With this strategy, there is usually no point in the receive buffer being larger than the window size.