mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 14:49:21 +00:00
feat: use local node by default for p2pool simple tab
This commit is contained in:
parent
1a16db6a5b
commit
59a9c0defe
2 changed files with 141 additions and 123 deletions
|
@ -33,10 +33,20 @@ impl P2pool {
|
||||||
// Two atomic bools = enough to represent this data
|
// Two atomic bools = enough to represent this data
|
||||||
|
|
||||||
// local or remote
|
// local or remote
|
||||||
|
// button bool
|
||||||
|
ui.vertical_centered(|ui|{
|
||||||
|
ui.add_space(space_h);
|
||||||
|
ui.checkbox(&mut self.local_node, "Use a local node").on_hover_text("If checked (recommended), p2pool will automatically use the local node.\nCheck the Node tab to start a local node.\nIf unchecked, p2pool will attempt to use a remote node.");
|
||||||
|
});
|
||||||
|
ui.add_space(space_h * 2.0);
|
||||||
|
|
||||||
|
// if checked, use only local node
|
||||||
|
// if unchecked, show remote nodes.
|
||||||
|
|
||||||
// disable remote if local is checked.
|
// disable remote if local is checked.
|
||||||
|
let visible = !self.local_node;
|
||||||
debug!("P2Pool Tab | Running [auto-select] check");
|
debug!("P2Pool Tab | Running [auto-select] check");
|
||||||
if self.auto_select {
|
if self.auto_select && visible {
|
||||||
let mut ping = lock!(ping);
|
let mut ping = lock!(ping);
|
||||||
// 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.pinged && !ping.auto_selected {
|
if ping.pinged && !ping.auto_selected {
|
||||||
|
@ -46,6 +56,7 @@ impl P2pool {
|
||||||
drop(ping);
|
drop(ping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui.add_enabled_ui(visible, |ui| {
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
debug!("P2Pool Tab | Rendering [Ping List]");
|
debug!("P2Pool Tab | Rendering [Ping List]");
|
||||||
|
@ -119,7 +130,9 @@ impl P2pool {
|
||||||
{
|
{
|
||||||
let ping = lock!(ping);
|
let ping = lock!(ping);
|
||||||
match ping.pinged {
|
match ping.pinged {
|
||||||
true => self.node = RemoteNode::get_last_from_ping(&self.node, &ping.nodes),
|
true => {
|
||||||
|
self.node = RemoteNode::get_last_from_ping(&self.node, &ping.nodes)
|
||||||
|
}
|
||||||
false => self.node = RemoteNode::get_last(&self.node),
|
false => self.node = RemoteNode::get_last(&self.node),
|
||||||
}
|
}
|
||||||
drop(ping);
|
drop(ping);
|
||||||
|
@ -132,7 +145,9 @@ impl P2pool {
|
||||||
{
|
{
|
||||||
let ping = lock!(ping);
|
let ping = lock!(ping);
|
||||||
match ping.pinged {
|
match ping.pinged {
|
||||||
true => self.node = RemoteNode::get_next_from_ping(&self.node, &ping.nodes),
|
true => {
|
||||||
|
self.node = RemoteNode::get_next_from_ping(&self.node, &ping.nodes)
|
||||||
|
}
|
||||||
false => self.node = RemoteNode::get_next(&self.node),
|
false => self.node = RemoteNode::get_next(&self.node),
|
||||||
}
|
}
|
||||||
drop(ping);
|
drop(ping);
|
||||||
|
@ -189,5 +204,6 @@ impl P2pool {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.on_hover_text(P2POOL_COMMUNITY_NODE_WARNING);
|
.on_hover_text(P2POOL_COMMUNITY_NODE_WARNING);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,6 +209,7 @@ pub struct Gupax {
|
||||||
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize)]
|
||||||
pub struct P2pool {
|
pub struct P2pool {
|
||||||
pub simple: bool,
|
pub simple: bool,
|
||||||
|
pub local_node: bool,
|
||||||
pub mini: bool,
|
pub mini: bool,
|
||||||
pub auto_ping: bool,
|
pub auto_ping: bool,
|
||||||
pub auto_select: bool,
|
pub auto_select: bool,
|
||||||
|
@ -487,6 +488,7 @@ impl Default for P2pool {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
simple: true,
|
simple: true,
|
||||||
|
local_node: true,
|
||||||
mini: true,
|
mini: true,
|
||||||
auto_ping: true,
|
auto_ping: true,
|
||||||
auto_select: true,
|
auto_select: true,
|
||||||
|
|
Loading…
Reference in a new issue