Skip to content

Commit

Permalink
Bug fixes (#23)
Browse files Browse the repository at this point in the history
* add threading
* sorted log and multiple probes

Fixes #3, fixes #22, fixes #16, maybe fixes #20
  • Loading branch information
johnshew authored Dec 3, 2020
1 parent c04bd59 commit 1b43ff6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,14 @@ impl GraphUi {
graph_bars.push(new_bar);
}
}

let mut data = self.data.borrow_mut();
data.bar_count = graph_bars_len;
data.min = min;
data.max = max;
if data.bar_count != data.bars.len() as u16 {
data.bars
.resize_with(graph_bars_len as usize, Default::default);
let len = data.bars.len();
println!("{}", len);
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ impl BasicApp {
// if offline_duration < 1.0 { continue; } // uncomment to ignore small duration timeouts
let message = format!("{}, {}, {}\r\n", start, end, offline_duration);
file.write_all(message.as_bytes()).unwrap();

} else {
continue;
}
Expand Down Expand Up @@ -345,9 +344,10 @@ impl BasicApp {
ping_response = None;
}
};
sender
.send((dst, timestamp, ping_response))
.expect("Should have sent");
if let Err(_e) = sender.send((dst, timestamp, ping_response)) {
break; // stop the loop if there is an error.
}
#[allow(deprecated)]
thread::sleep_ms(delay_millis);
}
});
Expand All @@ -361,7 +361,7 @@ fn main() -> std::io::Result<()> {
let app = BasicApp::build_ui(Default::default()).expect("Failed to build UI");
app.spawn_pinger("1.1.1.2", 600);
app.spawn_pinger("8.8.8.8", 600);
app.spawn_pinger("208.67.222.222",600);
app.spawn_pinger("208.67.222.222", 600);
nwg::dispatch_thread_events();
Ok(())
}

0 comments on commit 1b43ff6

Please sign in to comment.