1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
use std::{default::Default, time::Duration}; /// Contains Config properties which will be used by a Server or Client #[derive(Clone, Debug)] pub struct Config { /// The duration between each tick to be emitted by the Server (Client does /// not emit Tick events just yet) pub tick_interval: Duration, /// The duration between the resend of certain connection handshake messages pub send_handshake_interval: Duration, /// The duration to wait for communication from a remote host before /// initiating a disconnect pub disconnection_timeout_duration: Duration, /// The duration to wait before sending a heartbeat message to a remote /// host, if the host has not already sent another message within that time. pub heartbeat_interval: Duration, /// Value that specifies the factor used to smooth out network jitter. It /// defaults to 10% of the round-trip time. It is expressed as a ratio, with /// 0 equal to 0% and 1 equal to 100%. pub rtt_smoothing_factor: f32, /// Value which specifies the maximum round trip time before we consider it /// a problem. This is expressed in milliseconds. pub rtt_max_value: u16, } impl Default for Config { fn default() -> Self { Self { tick_interval: Duration::from_secs(1), disconnection_timeout_duration: Duration::from_secs(10), heartbeat_interval: Duration::from_secs(4), send_handshake_interval: Duration::from_secs(1), rtt_smoothing_factor: 0.10, rtt_max_value: 250, } } }