From 7f99c2828b5c65bd97df45e88fd8876cccf8f7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Fri, 15 May 2020 10:09:27 +0100 Subject: [PATCH] Added hidden init flag to increase default traffic volume (#234) --- clients/desktop/src/commands/init.rs | 8 ++++++++ clients/desktop/src/config/mod.rs | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/clients/desktop/src/commands/init.rs b/clients/desktop/src/commands/init.rs index 527c203269..740479bf7c 100644 --- a/clients/desktop/src/commands/init.rs +++ b/clients/desktop/src/commands/init.rs @@ -57,6 +57,11 @@ pub fn command_args<'a, 'b>() -> clap::App<'a, 'b> { .help("Port for the socket (if applicable) to listen on in all subsequent runs") .takes_value(true) ) + .arg(Arg::with_name("fastmode") + .long("fastmode") + .hidden(true) // this will prevent this flag from being displayed in `--help` + .help("Mostly debug-related option to increase default traffic rate so that you would not need to modify config post init") + ) } async fn try_gateway_registration( @@ -120,6 +125,9 @@ pub fn execute(matches: &ArgMatches) { let mut config = crate::config::Config::new(id); config = override_config(config, matches); + if matches.is_present("fastmode") { + config = config.set_high_default_traffic_volume(); + } let mix_identity_keys = MixIdentityKeyPair::new(); diff --git a/clients/desktop/src/config/mod.rs b/clients/desktop/src/config/mod.rs index 260b4fefec..8ab8826fd5 100644 --- a/clients/desktop/src/config/mod.rs +++ b/clients/desktop/src/config/mod.rs @@ -144,6 +144,13 @@ impl Config { self } + pub fn set_high_default_traffic_volume(mut self) -> Self { + self.debug.average_packet_delay = 10; + self.debug.loop_cover_traffic_average_delay = 20; // 50 cover messages / s + self.debug.message_sending_average_delay = 5; // 200 "real" messages / s + self + } + // getters pub fn get_config_file_save_location(&self) -> PathBuf { self.config_directory().join(Self::config_file_name())