mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06: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 static final int IMPORT_BATCH_SIZE = 350;
|
||||||
private Long shutdownPtr;
|
private Long shutdownPtr;
|
||||||
private boolean terminating;
|
private boolean terminating;
|
||||||
|
private boolean ready;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
|
@ -128,6 +129,7 @@ public class Bwt {
|
||||||
}
|
}
|
||||||
|
|
||||||
NativeBwtDaemon.shutdown(shutdownPtr);
|
NativeBwtDaemon.shutdown(shutdownPtr);
|
||||||
|
this.ready = false;
|
||||||
this.shutdownPtr = null;
|
this.shutdownPtr = null;
|
||||||
Platform.runLater(() -> EventManager.get().post(new BwtShutdownEvent()));
|
Platform.runLater(() -> EventManager.get().post(new BwtShutdownEvent()));
|
||||||
}
|
}
|
||||||
|
@ -136,6 +138,10 @@ public class Bwt {
|
||||||
return shutdownPtr != null;
|
return shutdownPtr != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isReady() {
|
||||||
|
return ready;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isTerminating() {
|
public boolean isTerminating() {
|
||||||
return terminating;
|
return terminating;
|
||||||
}
|
}
|
||||||
|
@ -269,6 +275,7 @@ public class Bwt {
|
||||||
@Override
|
@Override
|
||||||
public void onReady() {
|
public void onReady() {
|
||||||
log.debug("Bwt ready");
|
log.debug("Bwt ready");
|
||||||
|
ready = true;
|
||||||
if(!terminating) {
|
if(!terminating) {
|
||||||
Platform.runLater(() -> EventManager.get().post(new BwtReadyStatusEvent("Server ready")));
|
Platform.runLater(() -> EventManager.get().post(new BwtReadyStatusEvent("Server ready")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -908,11 +908,11 @@ public class ElectrumServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnecting() {
|
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() {
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue