mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-25 05:52:59 +02:00
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.
This commit is contained in:
@@ -809,12 +809,12 @@ static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break; // Connection succeeded, no need to retry.
|
break; // Connection succeeded, no need to retry.
|
||||||
} catch (const CConnectionFailed&) {
|
} catch (const CConnectionFailed& e) {
|
||||||
const int64_t now = GetTime<std::chrono::seconds>().count();
|
const int64_t now = GetTime<std::chrono::seconds>().count();
|
||||||
if (fWait && (timeout <= 0 || now < deadline)) {
|
if (fWait && (timeout <= 0 || now < deadline)) {
|
||||||
UninterruptibleSleep(std::chrono::seconds{1});
|
UninterruptibleSleep(std::chrono::seconds{1});
|
||||||
} else {
|
} else {
|
||||||
throw;
|
throw CConnectionFailed(strprintf("timeout on transient error: %s", e.what()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (fWait);
|
} while (fWait);
|
||||||
|
Reference in New Issue
Block a user