mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-11-16 15:27:46 +00:00
Merge branch 'dev' of github.com:mostafaei2002/gupaxx into dev
This commit is contained in:
commit
b0834d4c34
6 changed files with 158 additions and 124 deletions
|
@ -99,10 +99,7 @@ impl Gupax {
|
||||||
ui.add_sized(size, Checkbox::new(&mut self.auto_xmrig, "Auto-XMRig"))
|
ui.add_sized(size, Checkbox::new(&mut self.auto_xmrig, "Auto-XMRig"))
|
||||||
.on_hover_text(GUPAX_AUTO_XMRIG);
|
.on_hover_text(GUPAX_AUTO_XMRIG);
|
||||||
ui.separator();
|
ui.separator();
|
||||||
ui.add_sized(
|
ui.add_sized(size, Checkbox::new(&mut self.auto_xp, "Auto-Proxy"))
|
||||||
size,
|
|
||||||
Checkbox::new(&mut self.auto_xmrig, "Auto-XMRig-Proxy"),
|
|
||||||
)
|
|
||||||
.on_hover_text(GUPAX_AUTO_XMRIG_PROXY);
|
.on_hover_text(GUPAX_AUTO_XMRIG_PROXY);
|
||||||
ui.separator();
|
ui.separator();
|
||||||
ui.add_sized(size, Checkbox::new(&mut self.auto_xvb, "Auto-XvB"))
|
ui.add_sized(size, Checkbox::new(&mut self.auto_xvb, "Auto-XvB"))
|
||||||
|
|
|
@ -51,6 +51,7 @@ impl P2pool {
|
||||||
let text_edit = size.y / 25.0;
|
let text_edit = size.y / 25.0;
|
||||||
//---------------------------------------------------------------------------------------------------- [Simple] Console
|
//---------------------------------------------------------------------------------------------------- [Simple] Console
|
||||||
// debug!("P2Pool Tab | Rendering [Console]");
|
// debug!("P2Pool Tab | Rendering [Console]");
|
||||||
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||||
ui.group(|ui| {
|
ui.group(|ui| {
|
||||||
let text = &lock!(api).output;
|
let text = &lock!(api).output;
|
||||||
let nb_lines = num_lines(text);
|
let nb_lines = num_lines(text);
|
||||||
|
@ -171,5 +172,6 @@ impl P2pool {
|
||||||
} else {
|
} else {
|
||||||
self.advanced(ui, size, text_edit, node_vec);
|
self.advanced(ui, size, text_edit, node_vec);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ impl Xmrig {
|
||||||
let text_edit = size.y / 25.0;
|
let text_edit = size.y / 25.0;
|
||||||
//---------------------------------------------------------------------------------------------------- [Simple] Console
|
//---------------------------------------------------------------------------------------------------- [Simple] Console
|
||||||
debug!("XMRig Tab | Rendering [Console]");
|
debug!("XMRig Tab | Rendering [Console]");
|
||||||
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||||
ui.group(|ui| {
|
ui.group(|ui| {
|
||||||
let text = &lock!(api).output;
|
let text = &lock!(api).output;
|
||||||
let nb_lines = num_lines(text);
|
let nb_lines = num_lines(text);
|
||||||
|
@ -483,5 +484,6 @@ impl Xmrig {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ impl XmrigProxy {
|
||||||
let height = size.y;
|
let height = size.y;
|
||||||
let space_h = height / 48.0;
|
let space_h = height / 48.0;
|
||||||
let text_edit = size.y / 25.0;
|
let text_edit = size.y / 25.0;
|
||||||
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||||
ui.vertical_centered(|ui| {
|
ui.vertical_centered(|ui| {
|
||||||
ui.add_space(space_h);
|
ui.add_space(space_h);
|
||||||
ui.style_mut().override_text_style = Some(TextStyle::Heading);
|
ui.style_mut().override_text_style = Some(TextStyle::Heading);
|
||||||
|
@ -424,5 +425,6 @@ impl XmrigProxy {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ impl Helper {
|
||||||
state_xvb,
|
state_xvb,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
let xp_alive = lock!(process_xp).state == ProcessState::Alive;
|
let mut xp_alive = false;
|
||||||
// uptime for log of signal check ?
|
// uptime for log of signal check ?
|
||||||
let start = lock!(process).start;
|
let start = lock!(process).start;
|
||||||
// uptime of last run of algo
|
// uptime of last run of algo
|
||||||
|
@ -208,8 +208,12 @@ impl Helper {
|
||||||
debug!("XvB Watchdog | ----------- Start of loop -----------");
|
debug!("XvB Watchdog | ----------- Start of loop -----------");
|
||||||
// Set timer of loop
|
// Set timer of loop
|
||||||
let start_loop = std::time::Instant::now();
|
let start_loop = std::time::Instant::now();
|
||||||
|
// check if first loop the state of Xmrig-Proxy
|
||||||
|
if first_loop {
|
||||||
|
xp_alive = lock!(process_xp).state == ProcessState::Alive;
|
||||||
|
}
|
||||||
// verify if p2pool and xmrig are running, else XvB must be reloaded with another token/address to start verifying the other process.
|
// verify if p2pool and xmrig are running, else XvB must be reloaded with another token/address to start verifying the other process.
|
||||||
check_state_outcauses_xvb(
|
if check_state_outcauses_xvb(
|
||||||
&client,
|
&client,
|
||||||
gui_api,
|
gui_api,
|
||||||
pub_api,
|
pub_api,
|
||||||
|
@ -224,8 +228,12 @@ impl Helper {
|
||||||
state_p2pool,
|
state_p2pool,
|
||||||
state_xmrig,
|
state_xmrig,
|
||||||
state_xp,
|
state_xp,
|
||||||
|
xp_alive,
|
||||||
)
|
)
|
||||||
.await;
|
.await
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// check signal
|
// check signal
|
||||||
debug!("XvB | check signal");
|
debug!("XvB | check signal");
|
||||||
|
@ -512,6 +520,7 @@ async fn check_conditions_for_start(
|
||||||
lock!(process_xvb).signal = ProcessSignal::UpdateNodes(XvbNode::default());
|
lock!(process_xvb).signal = ProcessSignal::UpdateNodes(XvbNode::default());
|
||||||
lock!(process_xvb).state = state;
|
lock!(process_xvb).state = state;
|
||||||
}
|
}
|
||||||
|
/// return a bool to continue to next loop if needed.
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
async fn check_state_outcauses_xvb(
|
async fn check_state_outcauses_xvb(
|
||||||
client: &Client,
|
client: &Client,
|
||||||
|
@ -528,7 +537,8 @@ async fn check_state_outcauses_xvb(
|
||||||
state_p2pool: &crate::disk::state::P2pool,
|
state_p2pool: &crate::disk::state::P2pool,
|
||||||
state_xmrig: &crate::disk::state::Xmrig,
|
state_xmrig: &crate::disk::state::Xmrig,
|
||||||
state_xp: &crate::disk::state::XmrigProxy,
|
state_xp: &crate::disk::state::XmrigProxy,
|
||||||
) {
|
xp_start_alive: bool,
|
||||||
|
) -> bool {
|
||||||
// will check if the state can stay as it is.
|
// will check if the state can stay as it is.
|
||||||
// p2pool and xmrig are alive if ready and running (syncing is not alive).
|
// p2pool and xmrig are alive if ready and running (syncing is not alive).
|
||||||
let state = lock!(process).state;
|
let state = lock!(process).state;
|
||||||
|
@ -536,7 +546,18 @@ async fn check_state_outcauses_xvb(
|
||||||
let xp_is_alive = lock!(process_xp).state == ProcessState::Alive;
|
let xp_is_alive = lock!(process_xp).state == ProcessState::Alive;
|
||||||
let msg_xmrig_or_proxy = if xp_is_alive { "Xmrig-Proxy" } else { "Xmrig" };
|
let msg_xmrig_or_proxy = if xp_is_alive { "Xmrig-Proxy" } else { "Xmrig" };
|
||||||
// if state is not alive, the algo should stop if it was running and p2pool should be used by xmrig.
|
// if state is not alive, the algo should stop if it was running and p2pool should be used by xmrig.
|
||||||
|
|
||||||
if let Some(handle) = lock!(handle_algo).as_ref() {
|
if let Some(handle) = lock!(handle_algo).as_ref() {
|
||||||
|
// XvB should stop the algo if the state of xp is different from the start.
|
||||||
|
if xp_is_alive != xp_start_alive && !handle.is_finished() {
|
||||||
|
warn!("XvB Process | stop the algorithm because Xmrig-Proxy state changed");
|
||||||
|
output_console(
|
||||||
|
&mut lock!(gui_api).output,
|
||||||
|
"Algorithm stopped because Xmrig-Proxy state changed",
|
||||||
|
ProcessName::Xvb,
|
||||||
|
);
|
||||||
|
handle.abort();
|
||||||
|
}
|
||||||
if state != ProcessState::Alive && !handle.is_finished() {
|
if state != ProcessState::Alive && !handle.is_finished() {
|
||||||
handle.abort();
|
handle.abort();
|
||||||
output_console(
|
output_console(
|
||||||
|
@ -596,6 +617,12 @@ async fn check_state_outcauses_xvb(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if state of Xmrig-Proxy changed, go back to first loop
|
||||||
|
if xp_start_alive != xp_is_alive {
|
||||||
|
*first_loop = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
let is_xmrig_alive = lock!(process_xp).state == ProcessState::Alive
|
let is_xmrig_alive = lock!(process_xp).state == ProcessState::Alive
|
||||||
|| lock!(process_xmrig).state == ProcessState::Alive;
|
|| lock!(process_xmrig).state == ProcessState::Alive;
|
||||||
let is_p2pool_alive = lock!(process_p2pool).state == ProcessState::Alive;
|
let is_p2pool_alive = lock!(process_p2pool).state == ProcessState::Alive;
|
||||||
|
@ -645,6 +672,7 @@ async fn check_state_outcauses_xvb(
|
||||||
// nothing to do, we don't want to change other state
|
// nothing to do, we don't want to change other state
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
|
false
|
||||||
}
|
}
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn signal_interrupt(
|
fn signal_interrupt(
|
||||||
|
|
|
@ -132,7 +132,10 @@ impl XvbPrivStats {
|
||||||
);
|
);
|
||||||
output_console(
|
output_console(
|
||||||
&mut lock!(gui_api).output,
|
&mut lock!(gui_api).output,
|
||||||
&format!("Failure to retrieve private stats from {}", XVB_URL),
|
&format!(
|
||||||
|
"Failure to retrieve private stats from {} because of this error: {}",
|
||||||
|
XVB_URL, err
|
||||||
|
),
|
||||||
ProcessName::Xvb,
|
ProcessName::Xvb,
|
||||||
);
|
);
|
||||||
lock!(process).state = ProcessState::Retry;
|
lock!(process).state = ProcessState::Retry;
|
||||||
|
|
Loading…
Reference in a new issue