prevent reentry on connection
This commit is contained in:
@@ -552,7 +552,7 @@ void RPC::getInfoThenRefresh(bool force) {
|
|||||||
|
|
||||||
conn->doRPCIgnoreError(payload, [=](const json& reply) {
|
conn->doRPCIgnoreError(payload, [=](const json& reply) {
|
||||||
auto progress = reply["verificationprogress"].get<double>();
|
auto progress = reply["verificationprogress"].get<double>();
|
||||||
bool isSyncing = progress < 0.995; // 99.59%
|
bool isSyncing = progress < 0.9999; // 99.99%
|
||||||
int blockNumber = reply["blocks"].get<json::number_unsigned_t>();
|
int blockNumber = reply["blocks"].get<json::number_unsigned_t>();
|
||||||
|
|
||||||
int estimatedheight = 0;
|
int estimatedheight = 0;
|
||||||
@@ -601,9 +601,14 @@ void RPC::getInfoThenRefresh(bool force) {
|
|||||||
}, [=](QNetworkReply* reply, const json&) {
|
}, [=](QNetworkReply* reply, const json&) {
|
||||||
// zcashd has probably disappeared.
|
// zcashd has probably disappeared.
|
||||||
this->noConnection();
|
this->noConnection();
|
||||||
if (prevCallSucceeded) { // show error only first time
|
|
||||||
|
// Prevent multiple dialog boxes, because these are called async
|
||||||
|
static bool shown = false;
|
||||||
|
if (!shown && prevCallSucceeded) { // show error only first time
|
||||||
|
shown = true;
|
||||||
QMessageBox::critical(main, "Connection Error", "There was an error connecting to zcashd. The error was: \n\n"
|
QMessageBox::critical(main, "Connection Error", "There was an error connecting to zcashd. The error was: \n\n"
|
||||||
+ reply->errorString(), QMessageBox::StandardButton::Ok);
|
+ reply->errorString(), QMessageBox::StandardButton::Ok);
|
||||||
|
shown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
prevCallSucceeded = false;
|
prevCallSucceeded = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user