diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-08-14 10:32:11 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-08-14 10:32:11 +0200 |
commit | d3eac5f95c20a5d174654762c9d4f512d79ede21 (patch) | |
tree | 6cde8993d83d365bd7ba3d2bfdcbfc5c92939eed | |
parent | 0c2902ff3687d68c574067ddf1957ee61c6d6eff (diff) |
exit if ticking fails
rely on init to restart this service automatically
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 30edfe5..29e5435 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,7 @@ use std::fs::File; use std::mem::MaybeUninit; use std::net::{Ipv6Addr, SocketAddr, SocketAddrV6}; use std::os::fd::AsRawFd; +use std::process; use std::str::FromStr; use std::sync::{Arc, Mutex}; use std::thread; @@ -88,7 +89,10 @@ fn main() -> Result<()> { thread::spawn(move || loop { match tick(&sock2, state2.clone()) { Ok(_) => {} - Err(e) => println!("can't tick on ppp0: {}", e), + Err(e) => { + println!("can't tick on ppp0: {}", e); + process::exit(1); + } } thread::sleep(Duration::from_secs(3)); |