From 65a4d18412e787f7c82feacda5a9bfb697aa6d67 Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 22 Apr 2022 06:33:51 +0800 Subject: [PATCH] bin: added test-outbound-timeout option --- leaf-bin/src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/leaf-bin/src/main.rs b/leaf-bin/src/main.rs index 16efb19..f1bf958 100644 --- a/leaf-bin/src/main.rs +++ b/leaf-bin/src/main.rs @@ -54,6 +54,10 @@ struct Args { #[argh(option, short = 't')] test_outbound: Option, + /// timeout for outbound connectivity tests, in seconds + #[argh(option, short = 'd', default = "4")] + test_outbound_timeout: u64, + /// bound interface, explicitly sets the OUTBOUND_INTERFACE environment variable #[cfg(any(target_os = "macos", target_os = "linux"))] #[argh(option, short = 'b')] @@ -93,7 +97,11 @@ fn main() { .enable_all() .build() .unwrap(); - match rt.block_on(leaf::util::test_outbound(&tag, &config, None)) { + match rt.block_on(leaf::util::test_outbound( + &tag, + &config, + Some(std::time::Duration::from_secs(args.test_outbound_timeout)), + )) { Err(e) => { println!("test outbound failed: {}", e); exit(1);