mirror of
https://github.com/hinto-janai/gupax.git
synced 2025-03-20 14:18:44 +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|| {
|
std::thread::spawn(move|| {
|
||||||
info!("Spawning ping thread...");
|
info!("Spawning ping thread...");
|
||||||
match Self::ping(ping.clone(), og) {
|
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) => {
|
Err(err) => {
|
||||||
error!("Ping ... FAIL ... {}", err);
|
error!("Ping ... FAIL ... {}", err);
|
||||||
ping.lock().unwrap().pinged = false;
|
ping.lock().unwrap().pinged = false;
|
||||||
|
@ -274,9 +278,6 @@ impl Ping {
|
||||||
ping.nodes = node_vec;
|
ping.nodes = node_vec;
|
||||||
ping.prog = 100.0;
|
ping.prog = 100.0;
|
||||||
ping.msg = info;
|
ping.msg = info;
|
||||||
ping.pinging = false;
|
|
||||||
ping.pinged = true;
|
|
||||||
ping.auto_selected = false;
|
|
||||||
drop(ping);
|
drop(ping);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ impl P2pool {
|
||||||
if self.auto_select {
|
if self.auto_select {
|
||||||
let mut ping = ping.lock().unwrap();
|
let mut ping = ping.lock().unwrap();
|
||||||
// If we haven't auto_selected yet, auto-select and turn it off
|
// 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;
|
self.node = ping.fastest;
|
||||||
ping.auto_selected = true;
|
ping.auto_selected = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue