mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 06:39:21 +00:00
feat: put p2pool process to syncing if node doesn't respond anymore
This commit is contained in:
parent
06f8d9bc65
commit
536af2ce2a
3 changed files with 18 additions and 0 deletions
|
@ -31,6 +31,10 @@ impl P2pool {
|
|||
// saves me the hassle of wrapping [state: State] completely
|
||||
// and [.lock().unwrap()]ing it everywhere.
|
||||
// Two atomic bools = enough to represent this data
|
||||
|
||||
// local or remote
|
||||
|
||||
// disable remote if local is checked.
|
||||
debug!("P2Pool Tab | Running [auto-select] check");
|
||||
if self.auto_select {
|
||||
let mut ping = lock!(ping);
|
||||
|
|
|
@ -13,6 +13,7 @@ use crate::regex::contains_end_status;
|
|||
use crate::regex::contains_statuscommand;
|
||||
use crate::regex::contains_yourhashrate;
|
||||
use crate::regex::contains_yourshare;
|
||||
use crate::regex::contains_zmq_connection_lost;
|
||||
use crate::regex::estimated_hr;
|
||||
use crate::regex::nb_current_shares;
|
||||
use crate::regex::P2POOL_REGEX;
|
||||
|
@ -831,6 +832,14 @@ impl PubP2poolApi {
|
|||
lock!(process).state = ProcessState::Alive;
|
||||
}
|
||||
}
|
||||
// check if zmq server still alive
|
||||
if lock!(process).state == ProcessState::Alive
|
||||
&& contains_zmq_connection_lost(&output_parse)
|
||||
{
|
||||
// node zmq is not responding, p2pool is not ready
|
||||
lock!(process).state = ProcessState::Syncing;
|
||||
}
|
||||
|
||||
// 3. Throw away [output_parse]
|
||||
output_parse.clear();
|
||||
drop(output_parse);
|
||||
|
|
|
@ -224,6 +224,11 @@ pub fn contains_timeout(l: &str) -> bool {
|
|||
static LINE_SHARE: Lazy<Regex> = Lazy::new(|| Regex::new(r"timeout").unwrap());
|
||||
LINE_SHARE.is_match(l)
|
||||
}
|
||||
pub fn contains_zmq_connection_lost(l: &str) -> bool {
|
||||
static LINE_SHARE: Lazy<Regex> =
|
||||
Lazy::new(|| Regex::new(r"ZMQReader failed to connect to").unwrap());
|
||||
LINE_SHARE.is_match(l)
|
||||
}
|
||||
pub fn contains_error(l: &str) -> bool {
|
||||
static LINE_SHARE: Lazy<Regex> = Lazy::new(|| Regex::new(r"error").unwrap());
|
||||
LINE_SHARE.is_match(l)
|
||||
|
|
Loading…
Reference in a new issue