rpc: Prefix rpcwaittimeout error with details on its nature

As proposed by @laanwj the error message is now prefixed with the
"timeout on transient error:" prefix, to explain why the error is
suddenly considered terminal.
pull/826/head
Christian Decker 4 years ago
parent c490e17ef6
commit f76cb10d7d

@ -809,12 +809,12 @@ static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& str
}
}
break; // Connection succeeded, no need to retry.
} catch (const CConnectionFailed&) {
} catch (const CConnectionFailed& e) {
const int64_t now = GetTime<std::chrono::seconds>().count();
if (fWait && (timeout <= 0 || now < deadline)) {
UninterruptibleSleep(std::chrono::seconds{1});
} else {
throw;
throw CConnectionFailed(strprintf("timeout on transient error: %s", e.what()));
}
}
} while (fWait);

Loading…
Cancel
Save