mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-11-16 15:27:46 +00:00
fix: prevent potential deadlock
Some checks are pending
CI / ci (macos-12) (push) Waiting to run
CI / ci (ubuntu-latest) (push) Waiting to run
Lockbud / lockbud (push) Waiting to run
Rust / fmt (push) Waiting to run
Rust / test (macos-latest) (push) Waiting to run
Rust / test (ubuntu-latest) (push) Waiting to run
Rust / typo (push) Waiting to run
Rust / clippy (macos-latest) (push) Waiting to run
Rust / clippy (ubuntu-latest) (push) Waiting to run
Rust / check (macos-latest) (push) Waiting to run
Rust / check (ubuntu-latest) (push) Waiting to run
Rust / doc (macos-latest) (push) Waiting to run
Rust / doc (ubuntu-latest) (push) Waiting to run
Typo / typo (push) Waiting to run
Some checks are pending
CI / ci (macos-12) (push) Waiting to run
CI / ci (ubuntu-latest) (push) Waiting to run
Lockbud / lockbud (push) Waiting to run
Rust / fmt (push) Waiting to run
Rust / test (macos-latest) (push) Waiting to run
Rust / test (ubuntu-latest) (push) Waiting to run
Rust / typo (push) Waiting to run
Rust / clippy (macos-latest) (push) Waiting to run
Rust / clippy (ubuntu-latest) (push) Waiting to run
Rust / check (macos-latest) (push) Waiting to run
Rust / check (ubuntu-latest) (push) Waiting to run
Rust / doc (macos-latest) (push) Waiting to run
Rust / doc (ubuntu-latest) (push) Waiting to run
Typo / typo (push) Waiting to run
thanks lockbud CI !
This commit is contained in:
parent
7874e75f70
commit
c905d90e79
3 changed files with 6 additions and 3 deletions
|
@ -833,13 +833,13 @@ impl PubP2poolApi {
|
|||
process: &mut Process,
|
||||
) {
|
||||
// 1. Take the process's current output buffer and combine it with Pub (if not empty)
|
||||
let mut output_parse = output_parse.lock().unwrap();
|
||||
let mut output_pub = output_pub.lock().unwrap();
|
||||
if !output_pub.is_empty() {
|
||||
public.output.push_str(&std::mem::take(&mut *output_pub));
|
||||
}
|
||||
|
||||
// 2. Parse the full STDOUT
|
||||
let mut output_parse = output_parse.lock().unwrap();
|
||||
let (payouts_new, xmr_new) = Self::calc_payouts_and_xmr(&output_parse);
|
||||
// Check for "SYNCHRONIZED" only if we aren't already.
|
||||
if process.state == ProcessState::Syncing {
|
||||
|
@ -866,6 +866,7 @@ impl PubP2poolApi {
|
|||
|
||||
// 3. Throw away [output_parse]
|
||||
output_parse.clear();
|
||||
drop(output_pub);
|
||||
drop(output_parse);
|
||||
// 4. Add to current values
|
||||
let (payouts, xmr) = (public.payouts + payouts_new, public.xmr + xmr_new);
|
||||
|
|
|
@ -746,6 +746,7 @@ impl PubXmrigApi {
|
|||
process: &mut Process,
|
||||
) {
|
||||
// 1. Take the process's current output buffer and combine it with Pub (if not empty)
|
||||
let mut output_parse = output_parse.lock().unwrap();
|
||||
let mut output_pub = output_pub.lock().unwrap();
|
||||
|
||||
{
|
||||
|
@ -757,7 +758,6 @@ impl PubXmrigApi {
|
|||
}
|
||||
|
||||
// 2. Check for "new job"/"no active...".
|
||||
let mut output_parse = output_parse.lock().unwrap();
|
||||
if XMRIG_REGEX.new_job.is_match(&output_parse) {
|
||||
process.state = ProcessState::Alive;
|
||||
// get the pool we mine on to put it on stats
|
||||
|
@ -771,6 +771,7 @@ impl PubXmrigApi {
|
|||
|
||||
// 3. Throw away [output_parse]
|
||||
output_parse.clear();
|
||||
drop(output_pub);
|
||||
drop(output_parse);
|
||||
}
|
||||
|
||||
|
|
|
@ -504,6 +504,7 @@ impl PubXmrigProxyApi {
|
|||
process: &mut Process,
|
||||
) {
|
||||
// 1. Take the process's current output buffer and combine it with Pub (if not empty)
|
||||
let mut output_parse = output_parse.lock().unwrap();
|
||||
let mut output_pub = output_pub.lock().unwrap();
|
||||
|
||||
{
|
||||
|
@ -515,7 +516,6 @@ impl PubXmrigProxyApi {
|
|||
}
|
||||
|
||||
// 2. Check for "new job"/"no active...".
|
||||
let mut output_parse = output_parse.lock().unwrap();
|
||||
if XMRIG_REGEX.new_job.is_match(&output_parse)
|
||||
|| XMRIG_REGEX.valid_conn.is_match(&output_parse)
|
||||
{
|
||||
|
@ -533,6 +533,7 @@ impl PubXmrigProxyApi {
|
|||
}
|
||||
// 3. Throw away [output_parse]
|
||||
output_parse.clear();
|
||||
drop(output_pub);
|
||||
drop(output_parse);
|
||||
}
|
||||
// same method as PubXmrigApi, why not make a trait ?
|
||||
|
|
Loading…
Reference in a new issue