When Gupax can't read disk files at startup, it will [Error],
with an option to reset the state file, the user is given two
options [Yes] or [No].
Gupax's global error screen system ignores new errors from
overriding the current IF the current is a [Panic]. This makes
sure the worst errors stay on screen.
This also means after clicking [Yes], it will get ignored and the
screen won't change. So, allow for certain buttons to pass through.
I should probably re-make this whole global error screen system,
it's pretty much a global variable anyone can mutate randomly.
General cleanup and optimizations. Some functions are fixed,
some were turned into [const fn], and other small stuff like
[AtomicUnit] using a [u64] instead of a [u128]
Writing [a.lock().unwrap().b.lock().unwrap()] sucks, so these are
some macros that are for common situations. This commit also has
a [sed] replace on all previous code that _could_ have been a macro,
which they all are now.
Hopefully nothing breaks :D
This adds all necessary functions/conversions/serde/tests for the
new APIs. It also includes the actual reads inside the watchdog loop.
Every loop, [tick] will increment by 1. At [60], the watchdog
will attempt to read and parse the [network] & [pool] APIs.
Since the loop is [900ms], this means this will occur around
every 54 seconds. [tick] gets reset upon successful read/parsing.
Instead of a single "true" filename when walking dirs searching
for the newly downloaded (Gupax|P2Pool|XMRig), allow for multiple
valid names as long as they _seem_ correct AND are files, e.g:
GUPAX|Gupax|gupax (.exe)
P2POOL|P2Pool|P2pool|p2pool (.exe)
XMRIG|XMRig|Xmrig|xmrig (.exe)
If the packaging naming schemes change for any of these,
the update code will be able to actually handle it.
Includes some small fixes:
- [localhost] will always be changed to [127.0.0.1] in the case
of XMRig (it doesn't understand localhost by itself)
- P2Pool/XMRig API path now checks for a [/] or [\]
and correctly applies the endpoint, e.g:
BASEPATH = "/home/hinto/p2pool"
ENDPOINT = "local/stats"
if BASEPATH doesn't end with '/' { BASEPATH.push('/') }
API_PATH = BASEPATH + ENDPOINT ("/home/hinto/p2pool/local/stats")
- P2Pool payout line got changed in: be18ad4177
The regex is now a more generic: [payout of [0-9].[0-9]+ XMR]
Keyboard shortcuts [Left] & [Right] were clobbering the
[TextEdit] left/right movement, so they are now [Z/X].
The shortcuts also look to make sure a TextEdit isn't
in focus so that [S/R/Z/X] can actually be typed.
P2Pool/XMRig now make sure the path ends with an [ACCEPTABLE_*]
value (e.g: P2pool, P2POOL) before enabling the [Start] UI.
There was a deadlock happening between the [Helper]'s [gui_api_p2pool]
and the GUI's [gui_api_p2pool], since the locking order was different.
The watchdog loop locking order was fixed as well. This was a pain to
track down, better than a data race... I guess.
Oh and keyboard shortcuts were added in this commit too.
Comment from code:
// The ordering of these locks is _very_ important. They MUST be in sync
// with how the main GUI thread locks stuff or a deadlock will occur
// given enough time. They will eventually both want to lock the [Arc<Mutex>]
// the other thread is already locking. Yes, I figured this out the hard way,
// hence the vast amount of debug!() messages.
//
// Example of different order (BAD!):
//
// GUI Main -> locks [p2pool] first
// Helper -> locks [gui_api_p2pool] first
// GUI Status Tab -> trys to lock [gui_api_p2pool] -> CAN'T
// Helper -> trys to lock [p2pool] -> CAN'T
//
// These two threads are now in a deadlock because both
// are trying to access locks the other one already has.
//
// The locking order here must be in the same chronological
// order as the main GUI thread (top to bottom).
The entire codebase is now littered with [debug!()] messages.
Thankfully [log] has 0 cost if you aren't using them, so regular
users won't have a runtime penalty unless they specify RUST_LOG=debug.
A [must_resize] and [ctx.is_pointer_over_area()] is now used to
indicate we need a resizing. This makes it so when a user is
resizing the width of Gupax, the heavy [init_text_styles()] func
will only get called once when the user hovers over the GUI.
The button size is also now set in that function so it doesn't
have to be called in every separate tab.