fix isconnecting with ready status flag

This commit is contained in:
Craig Raw 2021-01-12 10:37:22 +02:00
parent 99959470e2
commit 6637ea09bf
2 changed files with 9 additions and 2 deletions

View file

@ -26,6 +26,7 @@ public class Bwt {
private static final int IMPORT_BATCH_SIZE = 350;
private Long shutdownPtr;
private boolean terminating;
private boolean ready;
static {
try {
@ -128,6 +129,7 @@ public class Bwt {
}
NativeBwtDaemon.shutdown(shutdownPtr);
this.ready = false;
this.shutdownPtr = null;
Platform.runLater(() -> EventManager.get().post(new BwtShutdownEvent()));
}
@ -136,6 +138,10 @@ public class Bwt {
return shutdownPtr != null;
}
public boolean isReady() {
return ready;
}
public boolean isTerminating() {
return terminating;
}
@ -269,6 +275,7 @@ public class Bwt {
@Override
public void onReady() {
log.debug("Bwt ready");
ready = true;
if(!terminating) {
Platform.runLater(() -> EventManager.get().post(new BwtReadyStatusEvent("Server ready")));
}

View file

@ -908,11 +908,11 @@ public class ElectrumServer {
}
public boolean isConnecting() {
return isRunning() && Config.get().getServerType() == ServerType.BITCOIN_CORE && !bwt.isRunning();
return isRunning() && Config.get().getServerType() == ServerType.BITCOIN_CORE && bwt.isRunning() && !bwt.isReady();
}
public boolean isConnected() {
return isRunning() && (Config.get().getServerType() != ServerType.BITCOIN_CORE || bwt.isRunning());
return isRunning() && (Config.get().getServerType() != ServerType.BITCOIN_CORE || (bwt.isRunning() && bwt.isReady()));
}
@Override