From 3beb37c0b5e8ecb38e6b773e12ee8416972a44e1 Mon Sep 17 00:00:00 2001 From: ache Date: Tue, 4 Aug 2026 10:03:51 +0200 Subject: Quit on error (Network for example) --- src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index cf24d9b..db0edf7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -73,11 +73,10 @@ async fn main() { states[id as usize] = State::Received { rtt: rrt, ttl }; } } - PingResult::NoPingErr { id, error } => { - // NOTE: Maybe we should quit, I don't know. - if (id as usize) < states.len() { - states[id as usize] = State::SendError; - } + PingResult::NoPingErr { id: _, ref error } => { + // FEAT: It should fail if states is empty and print a informative characters on the line otherwise + eprintln!("Error: {}", error); + std::process::exit(2); } } } -- cgit v1.3-2-g11bf