mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
fix isconnecting with ready status flag
This commit is contained in:
parent
99959470e2
commit
6637ea09bf
2 changed files with 9 additions and 2 deletions
|
@ -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")));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue