Skip to content
This repository was archived by the owner on Dec 10, 2022. It is now read-only.

Commit b5bafbc

Browse files
authored
Merge pull request #45 from tox-rs/required_tcp_address_fix
Do not require tcp-address
2 parents d4438e2 + 09fba28 commit b5bafbc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/node_config.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,11 @@ pub fn cli_parse() -> NodeConfig {
178178
.arg(Arg::with_name("tcp-connections-limit")
179179
.short("c")
180180
.long("tcp-connections-limit")
181-
.help("Maximum number of active TCP connections relay can hold")
181+
.help("Maximum number of active TCP connections relay can hold. \
182+
Defaults to 512 when tcp-address is specified")
182183
.requires("tcp-address")
183184
.takes_value(true)
184-
.default_value("512"))
185+
.default_value_if("tcp-address", None, "512"))
185186
.arg(Arg::with_name("secret-key")
186187
.short("s")
187188
.long("secret-key")
@@ -298,7 +299,11 @@ fn run_args(matches: &ArgMatches) -> NodeConfig {
298299
Vec::new()
299300
};
300301

301-
let tcp_connections_limit = value_t!(matches.value_of("tcp-connections-limit"), usize).unwrap_or_else(|e| e.exit());
302+
let tcp_connections_limit = if matches.is_present("tcp-connections-limit") {
303+
value_t!(matches.value_of("tcp-connections-limit"), usize).unwrap_or_else(|e| e.exit())
304+
} else {
305+
512
306+
};
302307

303308
let sk = matches.value_of("secret-key").map(|s| {
304309
let sk_bytes: [u8; 32] = FromHex::from_hex(s).expect("Invalid DHT secret key");

0 commit comments

Comments
 (0)