mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 19:49:32 +00:00
set or clear connection error message on each daemon poll
This commit is contained in:
parent
0bc5300a27
commit
83352ec1e3
1 changed files with 10 additions and 4 deletions
|
@ -566,13 +566,17 @@ public final class CoreMoneroConnectionsService {
|
|||
if (lastErrorTimestamp != null) {
|
||||
log.info("Successfully fetched daemon info after previous error");
|
||||
lastErrorTimestamp = null;
|
||||
if (HavenoUtils.havenoSetup != null) HavenoUtils.havenoSetup.getWalletServiceErrorMsg().set(null);
|
||||
}
|
||||
|
||||
// update and notify connected state
|
||||
if (!Boolean.TRUE.equals(connectionManager.isConnected())) {
|
||||
connectionManager.checkConnection();
|
||||
}
|
||||
|
||||
// clear error message
|
||||
if (Boolean.TRUE.equals(connectionManager.isConnected()) && HavenoUtils.havenoSetup != null) {
|
||||
HavenoUtils.havenoSetup.getWalletServiceErrorMsg().set(null);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
// log error message periodically
|
||||
|
@ -582,14 +586,16 @@ public final class CoreMoneroConnectionsService {
|
|||
if (DevEnv.isDevMode()) e.printStackTrace();
|
||||
}
|
||||
|
||||
// notify error message
|
||||
if (HavenoUtils.havenoSetup != null) HavenoUtils.havenoSetup.getWalletServiceErrorMsg().set(e.getMessage());
|
||||
|
||||
// check connection which notifies of changes
|
||||
synchronized (this) {
|
||||
if (connectionManager.getAutoSwitch()) connectionManager.setConnection(connectionManager.getBestAvailableConnection());
|
||||
else connectionManager.checkConnection();
|
||||
}
|
||||
|
||||
// set error message
|
||||
if (!Boolean.TRUE.equals(connectionManager.isConnected()) && HavenoUtils.havenoSetup != null) {
|
||||
HavenoUtils.havenoSetup.getWalletServiceErrorMsg().set(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue