[][src]Struct quinn::TransportConfig

pub struct TransportConfig {
    pub stream_window_bidi: u64,
    pub stream_window_uni: u64,
    pub idle_timeout: u64,
    pub stream_receive_window: u64,
    pub receive_window: u64,
    pub send_window: u64,
    pub max_tlps: u32,
    pub packet_threshold: u32,
    pub time_threshold: u16,
    pub delayed_ack_timeout: u64,
    pub initial_rtt: u64,
    pub max_datagram_size: u64,
    pub initial_window: u64,
    pub minimum_window: u64,
    pub loss_reduction_factor: u16,
    pub persistent_congestion_threshold: u32,
    pub keep_alive_interval: u32,
    pub crypto_buffer_size: usize,
    pub allow_spin: bool,
    pub datagram_receive_buffer_size: Option<usize>,
    pub datagram_send_buffer_size: usize,
}

Parameters governing the core QUIC state machine

Default values should be suitable for most internet applications. Applications protocols which forbid remotely-initiated streams should set stream_window_bidi and stream_window_uni to zero.

In some cases, performance or resource requirements can be improved by tuning these values to suit a particular application and/or network connection. In particular, window sizes for streams, stream data, and overall connection data can be tuned for a particular expected round trip time, link capacity, memory availability, and rate of stream creation. Tuning for higher bandwidths and latencies increases worst-case memory consumption, but does not impair performance at lower bandwidths and latencies. The default configuration is tuned for a 100Mbps link with a 100ms round trip time, with remote endpoints opening at most 320 new streams per second.

Fields

stream_window_bidi: u64

Maximum number of bidirectional streams that may be initiated by the peer but not yet accepted locally

Must be nonzero for the peer to open any bidirectional streams.

Any number of streams may be in flight concurrently. However, to ensure predictable resource use, the number of streams which the peer has initiated but which the local application has not yet accepted will be kept below this threshold.

Because it takes at least one round trip for an endpoint to open a new stream and be notified of its peer's flow control updates, this imposes a hard upper bound on the number of streams that may be opened per round-trip. In other words, this should be set to at least the desired number of streams opened per unit time, multiplied by the round trip time.

Note that worst-case memory use is directly proportional to stream_window_bidi * stream_receive_window, with an upper bound proportional to receive_window.

stream_window_uni: u64

Variant of stream_window_bidi affecting unidirectional streams

idle_timeout: u64

Maximum duration of inactivity to accept before timing out the connection (ms).

The actual value used is the minimum of this and the peer's own idle timeout. 0 for none.

stream_receive_window: u64

Maximum number of bytes the peer may transmit without acknowledgement on any one stream before becoming blocked.

This should be set to at least the expected connection latency multiplied by the maximum desired throughput. Setting this smaller than receive_window helps ensure that a single stream doesn't monopolize receive buffers, which may otherwise occur if the application chooses not to read from a large stream for a time while still requiring data on other streams.

receive_window: u64

Maximum number of bytes the peer may transmit across all streams of a connection before becoming blocked.

This should be set to at least the expected connection latency multiplied by the maximum desired throughput. Larger values can be useful to allow maximum throughput within a stream while another is blocked.

send_window: u64

Maximum number of bytes to transmit to a peer without acknowledgment

Provides an upper bound on memory when communicating with peers that issue large amounts of flow control credit. Endpoints that wish to handle large numbers of connections robustly should take care to set this low enough to guarantee memory exhaustion does not occur if every connection uses the entire window.

max_tlps: u32

Maximum number of tail loss probes before an RTO fires.

packet_threshold: u32

Maximum reordering in packet number space before FACK style loss detection considers a packet lost.

time_threshold: u16

Maximum reordering in time space before time based loss detection considers a packet lost. 0.16 format, added to 1

delayed_ack_timeout: u64

The length of the peer’s delayed ack timer (μs).

initial_rtt: u64

The RTT used before an RTT sample is taken (μs)

max_datagram_size: u64

The sender’s maximum UDP payload size. Does not include UDP or IP overhead.

Used for calculating initial and minimum congestion windows.

initial_window: u64

Default limit on the amount of outstanding data in bytes.

Recommended value: min(10 * max_datagram_size, max(2 * max_datagram_size, 14720))

minimum_window: u64

Default minimum congestion window.

Recommended value: 2 * max_datagram_size.

loss_reduction_factor: u16

Reduction in congestion window when a new loss event is detected. 0.16 format

persistent_congestion_threshold: u32

Number of consecutive PTOs after which network is considered to be experiencing persistent congestion.

keep_alive_interval: u32

Number of milliseconds of inactivity before sending a keep-alive packet

Keep-alive packets prevent an inactive but otherwise healthy connection from timing out.

0 to disable, which is the default. Only one side of any given connection needs keep-alive enabled for the connection to be preserved. Must be set lower than the idle_timeout of both peers to be effective.

crypto_buffer_size: usize

Maximum quantity of out-of-order crypto layer data to buffer

allow_spin: bool

Whether the implementation is permitted to set the spin bit on this connection

This allows passive observers to easily judge the round trip time of a connection, which can be useful for network administration but sacrifices a small amount of privacy.

datagram_receive_buffer_size: Option<usize>

Maximum number of incoming application datagram bytes to buffer, or None to disable datagrams

The peer is forbidden to send single datagrams larger than this size. If the aggregate size of all datagrams that have been received from the peer but not consumed by the application exceeds this value, old datagrams are dropped until it is no longer exceeded.

datagram_send_buffer_size: usize

Maximum number of outgoing application datagram bytes to buffer

While datagrams are sent ASAP, it is possible for an application to generate data faster than the link, or even the underlying hardware, can transmit them. This limits the amount of memory that may be consumed in that case.

Trait Implementations

impl Debug for TransportConfig[src]

impl Default for TransportConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,