diff --git a/src/rpc/rpc_client.cpp b/src/rpc/rpc_client.cpp index 0a2e7b1..18f2fdf 100644 --- a/src/rpc/rpc_client.cpp +++ b/src/rpc/rpc_client.cpp @@ -189,9 +189,14 @@ bool RPCClient::connect(const std::string& host, const std::string& port, const long connectTimeout = Connection::isLocalHost(host) ? 2L : 10L; curl_easy_setopt(impl_->curl, CURLOPT_CONNECTTIMEOUT, connectTimeout); - // Test connection with getinfo + // Test connection with getinfo. Use a SHORT timeout for the probe on localhost: a healthy + // local daemon answers in milliseconds and a warming one returns -28 just as fast, so a long + // hang means a wedged/loading occupant — no point blocking the full 30s before we retry and + // update the UI. (call(timeoutSec) restores the persistent 30s afterwards, so normal RPC calls + // that legitimately take longer are unaffected.) Remote/TLS daemons keep the full budget. + const long probeTimeout = Connection::isLocalHost(host) ? 8L : 30L; try { - json result = call("getinfo"); + json result = call("getinfo", json::array(), probeTimeout); if (result.contains("version")) { connected_ = true; warming_up_ = false;