mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
fix isconnecting state change
This commit is contained in:
parent
fb25edb51c
commit
e39a2cb944
2 changed files with 6 additions and 5 deletions
|
@ -284,7 +284,7 @@ public class AppServices {
|
||||||
});
|
});
|
||||||
connectionService.setOnFailed(failEvent -> {
|
connectionService.setOnFailed(failEvent -> {
|
||||||
//Close connection here to create a new transport next time we try
|
//Close connection here to create a new transport next time we try
|
||||||
connectionService.resetConnection();
|
connectionService.closeConnection();
|
||||||
|
|
||||||
if(failEvent.getSource().getException() instanceof ServerConfigException) {
|
if(failEvent.getSource().getException() instanceof ServerConfigException) {
|
||||||
connectionService.setRestartOnFailure(false);
|
connectionService.setRestartOnFailure(false);
|
||||||
|
|
|
@ -1176,7 +1176,7 @@ public class ElectrumServer {
|
||||||
return new FeeRatesUpdatedEvent(blockTargetFeeRates, mempoolRateSizes);
|
return new FeeRatesUpdatedEvent(blockTargetFeeRates, mempoolRateSizes);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resetConnection();
|
closeConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1185,18 +1185,18 @@ public class ElectrumServer {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetConnection() {
|
public void closeConnection() {
|
||||||
try {
|
try {
|
||||||
closeActiveConnection();
|
closeActiveConnection();
|
||||||
shutdown();
|
shutdown();
|
||||||
firstCall = true;
|
firstCall = true;
|
||||||
} catch (ServerException e) {
|
} catch (ServerException e) {
|
||||||
log.error("Error closing connection during connection reset", e);
|
log.error("Error closing connection", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnecting() {
|
public boolean isConnecting() {
|
||||||
return isRunning() && firstCall && (Config.get().getServerType() != ServerType.BITCOIN_CORE || (bwt.isRunning() && !bwt.isReady()));
|
return isRunning() && firstCall && !shutdown && (Config.get().getServerType() != ServerType.BITCOIN_CORE || (bwt.isRunning() && !bwt.isReady()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnectionRunning() {
|
public boolean isConnectionRunning() {
|
||||||
|
@ -1250,6 +1250,7 @@ public class ElectrumServer {
|
||||||
public void reset() {
|
public void reset() {
|
||||||
super.reset();
|
super.reset();
|
||||||
firstCall = true;
|
firstCall = true;
|
||||||
|
shutdown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue