Struct uflow::EndpointConfig

source ·
pub struct EndpointConfig {
    pub max_send_rate: usize,
    pub max_receive_rate: usize,
    pub max_packet_size: usize,
    pub max_receive_alloc: usize,
    pub keepalive: bool,
    pub keepalive_interval_ms: u64,
    pub active_timeout_ms: u64,
}
Expand description

Parameters used to configure either endpoint of a uflow connection.

Fields§

§max_send_rate: usize

The maximum send rate, in bytes per second. The endpoint will ensure that its outgoing bandwidth does not exceed this value.

Must be greater than 0. Values larger than 2^32 will be truncated.

§max_receive_rate: usize

The maximum acceptable receive rate, in bytes per second. The opposing endpoint will ensure that its outgoing bandwidth does not exceed this value.

Must be greater than 0. Values larger than 2^32 will be truncated.

§max_packet_size: usize

The maximum size of a sent packet, in bytes. The endpoint will ensure that it does not send packets with a size exceeding this value.

Must be greater than 0, and less than or equal to MAX_PACKET_SIZE.

§max_receive_alloc: usize

The maximum allocation size of the endpoint’s receive buffer, in bytes. The endpoint will ensure that the total amount of memory allocated to receive packet data doesn’t exceed this value, rounded up to the nearest multiple of MAX_FRAGMENT_SIZE.

Must be greater than 0.

Note: The maximum allocation size necessarily constrains the maximum receivable packet size. A connection attempt will fail if the max_packet_size of the opposing endpoint exceeds this value.

§keepalive: bool

Whether the endpoint should automatically send keepalive frames if no data has been sent for one keepalive interval (see keepalive_interval_ms). If set to false, one endpoint must continually send data to avoid causing a timeout on the opposite host.

§keepalive_interval_ms: u64

The interval in milliseconds at which keepalive frames are sent.

Note: Keepalive frames will not be sent faster than the connection RTO (computed according to TFRC) or 2s, whichever is longer.

§active_timeout_ms: u64

Time in milliseconds after which an active connection will terminate if no frames have been received from the remote endpoint.

Implementations§

Returns true if each parameter has a valid value.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Creates an endpoint configuration with the following parameters:

  • Maximum outgoing bandwidth: 2MB/s
  • Maximum incoming bandwidth: 2MB/s
  • Maximum packet size: 1MB
  • Maximum packet receive allocation: 1MB
  • Keepalive: true
  • Keepalive interval: 5s
  • Active timeout: 20s

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.