diff --git a/nym-client/src/config/mod.rs b/nym-client/src/config/mod.rs index 5ae2bd1e96..61ecf79093 100644 --- a/nym-client/src/config/mod.rs +++ b/nym-client/src/config/mod.rs @@ -7,12 +7,12 @@ use std::path::PathBuf; pub mod persistance; mod template; -// all of the below are defined in seconds -const DEFAULT_LOOP_COVER_SENDING_AVERAGE_DELAY: f64 = 1.0; -const DEFAULT_MESSAGE_SENDING_AVERAGE_DELAY: f64 = 0.5; -const DEFAULT_AVERAGE_PACKET_DELAY: f64 = 0.2; -const DEFAULT_FETCH_MESSAGES_DELAY: f64 = 1.0; -const DEFAULT_TOPOLOGY_REFRESH_RATE: f64 = 10.0; +// all of the below are defined in milliseconds +const DEFAULT_LOOP_COVER_STREAM_AVERAGE_DELAY: u64 = 1000; +const DEFAULT_MESSAGE_STREAM_AVERAGE_DELAY: u64 = 500; +const DEFAULT_AVERAGE_PACKET_DELAY: u64 = 200; +const DEFAULT_FETCH_MESSAGES_DELAY: u64 = 1000; +const DEFAULT_TOPOLOGY_REFRESH_RATE: u64 = 10_000; #[derive(Debug, Default, Deserialize, PartialEq, Serialize)] #[serde(deny_unknown_fields)] @@ -175,27 +175,27 @@ pub struct Debug { /// sent packet is going to be delayed at any given mix node. /// So for a packet going through three mix nodes, on average, it will take three times this value /// until the packet reaches its destination. - /// The provided value is interpreted as seconds. - average_packet_delay: f64, + /// The provided value is interpreted as milliseconds. + average_packet_delay: u64, /// The parameter of Poisson distribution determining how long, on average, /// it is going to take for another loop cover traffic message to be sent. /// If set to a negative value, the loop cover traffic stream will be disabled. - /// The provided value is interpreted as seconds. - loop_cover_traffic_average_delay: f64, + /// The provided value is interpreted as milliseconds. + loop_cover_traffic_average_delay: u64, /// The uniform delay every which clients are querying the providers for received packets. /// If set to a negative value, client will never try to fetch their messages. - /// The provided value is interpreted as seconds. - fetch_message_delay: f64, + /// The provided value is interpreted as milliseconds. + fetch_message_delay: u64, /// The parameter of Poisson distribution determining how long, on average, /// it is going to take another 'real traffic stream' message to be sent. /// If no real packets are available and cover traffic is enabled, /// a loop cover message is sent instead in order to preserve the rate. /// If set to a negative value, client will never try to send real traffic data. - /// The provided value is interpreted as seconds. - message_sending_average_delay: f64, + /// The provided value is interpreted as milliseconds. + message_sending_average_delay: u64, /// Whether loop cover messages should be sent to respect message_sending_rate. /// In the case of it being disabled and not having enough real traffic @@ -207,17 +207,17 @@ pub struct Debug { /// to try to obtain a compatible network topology to send sphinx packets through. /// If set to a negative value, client will never try to refresh its topology, /// meaning it will always try to use whatever it obtained on startup. - /// The provided value is interpreted as seconds. - topology_refresh_rate: f64, + /// The provided value is interpreted as milliseconds. + topology_refresh_rate: u64, } impl Default for Debug { fn default() -> Self { Debug { average_packet_delay: DEFAULT_AVERAGE_PACKET_DELAY, - loop_cover_traffic_average_delay: DEFAULT_LOOP_COVER_SENDING_AVERAGE_DELAY, + loop_cover_traffic_average_delay: DEFAULT_LOOP_COVER_STREAM_AVERAGE_DELAY, fetch_message_delay: DEFAULT_FETCH_MESSAGES_DELAY, - message_sending_average_delay: DEFAULT_MESSAGE_SENDING_AVERAGE_DELAY, + message_sending_average_delay: DEFAULT_MESSAGE_STREAM_AVERAGE_DELAY, rate_compliant_cover_messages_disabled: false, topology_refresh_rate: DEFAULT_TOPOLOGY_REFRESH_RATE, }