mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-11-17 07:47:35 +00:00
p2pool: refine ping auto_select
This commit is contained in:
parent
0b8d65ae6e
commit
88e172a2e3
2 changed files with 6 additions and 5 deletions
|
@ -197,7 +197,11 @@ impl Ping {
|
|||
std::thread::spawn(move|| {
|
||||
info!("Spawning ping thread...");
|
||||
match Self::ping(ping.clone(), og) {
|
||||
Ok(_) => info!("Ping ... OK"),
|
||||
Ok(_) => {
|
||||
info!("Ping ... OK");
|
||||
ping.lock().unwrap().pinged = true;
|
||||
ping.lock().unwrap().auto_selected = false;
|
||||
},
|
||||
Err(err) => {
|
||||
error!("Ping ... FAIL ... {}", err);
|
||||
ping.lock().unwrap().pinged = false;
|
||||
|
@ -274,9 +278,6 @@ impl Ping {
|
|||
ping.nodes = node_vec;
|
||||
ping.prog = 100.0;
|
||||
ping.msg = info;
|
||||
ping.pinging = false;
|
||||
ping.pinged = true;
|
||||
ping.auto_selected = false;
|
||||
drop(ping);
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ impl P2pool {
|
|||
if self.auto_select {
|
||||
let mut ping = ping.lock().unwrap();
|
||||
// If we haven't auto_selected yet, auto-select and turn it off
|
||||
if ping.auto_selected == false {
|
||||
if ping.pinged && ping.auto_selected == false {
|
||||
self.node = ping.fastest;
|
||||
ping.auto_selected = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue