pub struct StreamConfig {
pub rx_buf_min_size: usize,
pub rx_buf_max_size: MaxMessageSizeMultiple,
pub tx_buf_min_size: usize,
pub tx_buf_max_size: MaxMessageSizeMultiple,
pub tx_timeout: Duration,
pub connect_timeout: Duration,
}Expand description
Stream related configuration parameters.
Fields§
§rx_buf_min_size: usizeDefines the minimum size of the per-connection receive buffer used for message reassembly. Low values will cause more frequent reallocation while high values will reallocate less at the expense of more memory usage. A buffer never shrinks to less than this value.
rx_buf_max_size: MaxMessageSizeMultipleDefines the maximum size of the per-connection receive buffer used for message reassembly.
This defaults to Message::MAX_SIZE. This number is very important in DoS mitigation
because it prevents a malicious sender from filling up a connection’s receive buffer with
endless junk data.
tx_buf_min_size: usizeDefines the minimum size of the per-connection send buffer. Low values will cause more frequent reallocation while high values will reallocate less at the expense of more memory usage. A buffer never shrinks to less than this value.
tx_buf_max_size: MaxMessageSizeMultipleDefines the maximum size of the per-connection send buffer. Once the send buffer is full, it
is not possible to queue new messages for sending until some capacity is available. A send
buffer becomes full when sending messages faster than the remote peer is reading. This value
is important for outbound backpressure control. Defaults to 2 x Message::MAX_SIZE.
tx_timeout: DurationThe duration after which a peer is disconnected if it fails to read our data.
connect_timeout: DurationThe duration after which a connect attempt is abandoned. Applies only to non-blocking connect attempts. Blocking ones performed in custom connectors ignore this value.
Trait Implementations§
Source§impl Clone for StreamConfig
impl Clone for StreamConfig
Source§fn clone(&self) -> StreamConfig
fn clone(&self) -> StreamConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more