cli_helpers: use anyhow in app fn; aquatic_ws: reorganize error handling

This commit is contained in:
Joakim Frostegård 2020-05-23 14:05:50 +02:00
parent 1efe6f96c5
commit 526faa9aab
13 changed files with 134 additions and 93 deletions

View file

@ -9,6 +9,7 @@ license = "Apache-2.0"
name = "aquatic_udp_load_test"
[dependencies]
anyhow = "1"
bittorrent_udp = { path = "../bittorrent_udp" }
cli_helpers = { path = "../cli_helpers" }
crossbeam-channel = "0.4"

View file

@ -32,7 +32,7 @@ pub fn main(){
}
fn run(config: Config){
fn run(config: Config) -> ::anyhow::Result<()> {
if config.handler.weight_announce + config.handler.weight_connect + config.handler.weight_scrape == 0 {
panic!("Error: at least one weight must be larger than zero.");
}
@ -129,7 +129,9 @@ fn run(config: Config){
monitor_statistics(
state,
&config
)
);
Ok(())
}