parses a file passed to use as a list of targets

This commit is contained in:
2025-04-20 19:48:31 -04:00
parent 1742874c46
commit d642822709
4 changed files with 60 additions and 18 deletions
+4 -4
View File
@@ -9,8 +9,8 @@ use crate::SECONDS_BETWEEN_PING;
pub struct Manager;
const WIN_PING_SUCCESS: u8 = 1;
const LIN_PING_SUCCESS: u8 = 0;
const WIN_PING_SUCCESS: i32 = 1;
const LIN_PING_SUCCESS: i32 = 0;
impl Manager {
pub fn spawn_manager_thread(targets: Vec<Ipv4Addr>, sender: Sender<PingResult>) {
@@ -40,7 +40,7 @@ impl Manager {
.arg("-w 10")
.arg("-4")
.output().unwrap().status.code().unwrap_or(255);
success = result == 1;
success = result == WIN_PING_SUCCESS as i32;;
}
#[cfg(any(target_os="linux"))] {
result = Command::new("/usr/bin/ping").arg(request.target.to_string())
@@ -49,7 +49,7 @@ impl Manager {
.arg("-w 10")
.arg("-W 1")
.output().unwrap().status.code().unwrap_or(255);
success = result == 0;
success = result == LIN_PING_SUCCESS as i32;
}
let ping_duration = SystemTime::now()
.duration_since(start_time)