mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-11-16 15:58:08 +00:00
set poll in progress from single caller at a time
This commit is contained in:
parent
7094dfcc09
commit
329fa1c39a
2 changed files with 25 additions and 5 deletions
|
@ -2500,10 +2500,18 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
}
|
||||
|
||||
private void doPollWallet() {
|
||||
|
||||
// skip if shut down started
|
||||
if (isShutDownStarted) return;
|
||||
|
||||
// set poll in progress
|
||||
boolean pollInProgressSet = false;
|
||||
synchronized (pollLock) {
|
||||
if (!pollInProgress) pollInProgressSet = true;
|
||||
pollInProgress = true;
|
||||
}
|
||||
|
||||
// poll wallet
|
||||
try {
|
||||
|
||||
// skip if payout unlocked
|
||||
|
@ -2628,8 +2636,10 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
}
|
||||
}
|
||||
} finally {
|
||||
synchronized (pollLock) {
|
||||
pollInProgress = false;
|
||||
if (pollInProgressSet) {
|
||||
synchronized (pollLock) {
|
||||
pollInProgress = false;
|
||||
}
|
||||
}
|
||||
requestSaveWallet();
|
||||
}
|
||||
|
|
|
@ -1837,10 +1837,18 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
}
|
||||
|
||||
private void doPollWallet(boolean updateTxs) {
|
||||
|
||||
// skip if shut down started
|
||||
if (isShutDownStarted) return;
|
||||
|
||||
// set poll in progress
|
||||
boolean pollInProgressSet = false;
|
||||
synchronized (pollLock) {
|
||||
if (!pollInProgress) pollInProgressSet = true;
|
||||
pollInProgress = true;
|
||||
}
|
||||
if (isShutDownStarted) return;
|
||||
|
||||
// poll wallet
|
||||
try {
|
||||
|
||||
// skip if daemon not synced
|
||||
|
@ -1903,8 +1911,10 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
//e.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
synchronized (pollLock) {
|
||||
pollInProgress = false;
|
||||
if (pollInProgressSet) {
|
||||
synchronized (pollLock) {
|
||||
pollInProgress = false;
|
||||
}
|
||||
}
|
||||
|
||||
// cache wallet info last
|
||||
|
|
Loading…
Reference in a new issue