Skip to content

Commit

Permalink
set poll in progress from single caller at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Oct 16, 2024
1 parent 54bccf7 commit c9e83b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
12 changes: 10 additions & 2 deletions core/src/main/java/haveno/core/trade/Trade.java
Original file line number Diff line number Diff line change
Expand Up @@ -2500,8 +2500,14 @@ private void pollWallet() {
}

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;
}
try {
Expand Down Expand Up @@ -2628,8 +2634,10 @@ else if (hasFailedTx && isPayoutPublished()) {
}
}
} finally {
synchronized (pollLock) {
pollInProgress = false;
if (pollInProgressSet) {
synchronized (pollLock) {
pollInProgress = false;
}
}
requestSaveWallet();
}
Expand Down
14 changes: 11 additions & 3 deletions core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1837,10 +1837,16 @@ private void pollWallet() {
}

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;
try {

// skip if daemon not synced
Expand Down Expand Up @@ -1903,8 +1909,10 @@ else if (isWalletConnectedToDaemon()) {
//e.printStackTrace();
}
} finally {
synchronized (pollLock) {
pollInProgress = false;
if (pollInProgressSet) {
synchronized (pollLock) {
pollInProgress = false;
}
}

// cache wallet info last
Expand Down

0 comments on commit c9e83b5

Please sign in to comment.