mirror of
https://github.com/retoaccess1/haveno-reto.git
synced 2024-11-13 22:53:37 +01:00
fix npe resuming from standby without monero connection
This commit is contained in:
parent
aeb0822f9f
commit
7fc2f5de52
@ -246,7 +246,7 @@ public final class CoreMoneroConnectionsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnectionLocal() {
|
public boolean isConnectionLocal() {
|
||||||
return getConnection() != null && HavenoUtils.isLocalHost(getConnection().getUri());
|
return isConnectionLocal(getConnection());
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getRefreshPeriodMs() {
|
public long getRefreshPeriodMs() {
|
||||||
@ -315,17 +315,20 @@ public final class CoreMoneroConnectionsService {
|
|||||||
|
|
||||||
// ------------------------------- HELPERS --------------------------------
|
// ------------------------------- HELPERS --------------------------------
|
||||||
|
|
||||||
|
private boolean isConnectionLocal(MoneroRpcConnection connection) {
|
||||||
|
return connection != null && HavenoUtils.isLocalHost(connection.getUri());
|
||||||
|
}
|
||||||
|
|
||||||
private long getDefaultRefreshPeriodMs() {
|
private long getDefaultRefreshPeriodMs() {
|
||||||
if (daemon == null) return REFRESH_PERIOD_LOCAL_MS;
|
MoneroRpcConnection connection = getConnection();
|
||||||
else {
|
if (connection == null) return REFRESH_PERIOD_LOCAL_MS;
|
||||||
if (isConnectionLocal()) {
|
if (isConnectionLocal(connection)) {
|
||||||
if (lastInfo != null && (lastInfo.isBusySyncing() || (lastInfo.getHeightWithoutBootstrap() != null && lastInfo.getHeightWithoutBootstrap() > 0 && lastInfo.getHeightWithoutBootstrap() < lastInfo.getHeight()))) return REFRESH_PERIOD_HTTP_MS; // refresh slower if syncing or bootstrapped
|
if (lastInfo != null && (lastInfo.isBusySyncing() || (lastInfo.getHeightWithoutBootstrap() != null && lastInfo.getHeightWithoutBootstrap() > 0 && lastInfo.getHeightWithoutBootstrap() < lastInfo.getHeight()))) return REFRESH_PERIOD_HTTP_MS; // refresh slower if syncing or bootstrapped
|
||||||
else return REFRESH_PERIOD_LOCAL_MS; // TODO: announce faster refresh after done syncing
|
else return REFRESH_PERIOD_LOCAL_MS; // TODO: announce faster refresh after done syncing
|
||||||
} else if (useProxy(getConnection())) {
|
} else if (useProxy(connection)) {
|
||||||
return REFRESH_PERIOD_ONION_MS;
|
return REFRESH_PERIOD_ONION_MS;
|
||||||
} else {
|
} else {
|
||||||
return REFRESH_PERIOD_HTTP_MS;
|
return REFRESH_PERIOD_HTTP_MS;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user