Struct cobalt::Config [] [src]

pub struct Config {
    pub send_rate: u64,
    pub packet_max_size: usize,
    pub protocol_header: [u8; 4],
    pub packet_drop_threshold: Duration,
    pub connection_init_threshold: Duration,
    pub connection_drop_threshold: Duration,
    pub connection_closing_threshold: Duration,
    pub message_quota_instant: f32,
    pub message_quota_reliable: f32,
    pub message_quota_ordered: f32,
    pub tick_overflow_recovery: bool,
    pub tick_overflow_recovery_rate: f32,
}

Structure defining connection and message configuration options.

Fields

Number of packets send per second. Default is 30.

Maximum bytes that can be received / send in one packet. Default 1400.

32-Bit Protocol ID used to identify UDP related packets. Default is [1, 2, 3, 4].

Maximum roundtrip-time in milliseconds before a packet is considered lost. Default is 1000.

Maximum time in milliseconds until the first packet must be received before a connection attempt fails. Default is 100.

Maximum time in milliseconds between any two packets before the connection gets dropped. Default is 1000.

Maximum time in milliseconds to wait for remote confirmation after programmatically closing a connection. Default is 150.

The percent of available packet bytes to use when serializing MessageKind::Instant into a packet via a MessageQueue.

The percent of available packet bytes to use when serializing MessageKind::Reliable into a packet via a MessageQueue.

The percent of available packet bytes to use when serializing MessageKind::Ordered into a packet via a MessageQueue.

Whether to keep track of ticks which exceed their maximum running time and speed up successive ticks in order to keep the desired target send_rate stable.

Each tick has a limit of the number of milliseconds in can take before the send_rate drops below the specified ticks per second target (1000 / send_rate milliseconds). Ticks which fall below this threshold will normally sleep for the remaining amount of time.

Ticks which exceed this threshold will normally cause the send_rate to drop below the target; however, with tick_overflow_recovery enabled any tick which falls below the threshold will give up some of its remaining sleep time in order to allow the send_rate to catch up again.

How much of each tick's sleep time is used for speedup purposes is determined by the value of tick_overflow_recovery.

Default is true.

Determines how much of each tick's sleep time may be used to reduce the current tick overflow time in order to smooth out the send_rate.

Values must be in the range of 0.0 to 1.0 where 0.25 would be a quarter of the tick's sleep time.

Example: For a send_rate of 30 with a maximum sleep time of 33.33 milliseconds, a tick_overflow_recovery_rate value of 0.5 would allow up to 16.66 milliseconds of sleep to be skipped.

Values smaller than 0.0 or bigger than 1.0 will have no effect.

Default is 1.0.

Trait Implementations

impl Copy for Config
[src]

impl Clone for Config
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Config
[src]

Formats the value using the given formatter.

impl PartialEq for Config
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Default for Config
[src]

Returns the "default value" for a type. Read more