Skip to content

Commit

Permalink
check for stop signal
Browse files Browse the repository at this point in the history
  • Loading branch information
bparli committed Jul 29, 2019
1 parent 55b7e8b commit 364cfc6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,6 @@ impl Pinger {

// run pinger either once or continuously
fn run_pings(&self, run_once: bool) {
{
let mut stop = self.stop.lock().unwrap();
if run_once {
debug!("Running pinger for one round");
*stop = true;
} else {
*stop = false;
}
}

let thread_rx = self.thread_rx.clone();
let tx = self.tx.clone();
let txv6 = self.txv6.clone();
Expand All @@ -180,6 +170,16 @@ impl Pinger {
let timer = self.timer.clone();
let max_rtt = self.max_rtt.clone();

{
let mut stop = self.stop.lock().unwrap();
if run_once {
debug!("Running pinger for one round");
*stop = true;
} else {
*stop = false;
}
}

if run_once {
send_pings(timer, stop, results_sender, thread_rx, tx, txv6, addrs, max_rtt);
} else {
Expand Down

0 comments on commit 364cfc6

Please sign in to comment.