diff --git a/src/rpc/rpc_client.h b/src/rpc/rpc_client.h index 9f2f4e5..bb3ba06 100644 --- a/src/rpc/rpc_client.h +++ b/src/rpc/rpc_client.h @@ -301,9 +301,9 @@ private: std::string host_; std::string port_; std::string auth_; // Base64 encoded "user:password" - bool connected_ = false; + std::atomic connected_{false}; std::atomic abort_{false}; // set cross-thread to abort an in-flight transfer - bool warming_up_ = false; + std::atomic warming_up_{false}; std::string warmup_status_; std::string last_connect_error_; RpcFailureKind last_connect_kind_ = RpcFailureKind::None; diff --git a/src/rpc/rpc_worker.cpp b/src/rpc/rpc_worker.cpp index 98b4da3..0ba9cf6 100644 --- a/src/rpc/rpc_worker.cpp +++ b/src/rpc/rpc_worker.cpp @@ -142,6 +142,10 @@ void RPCWorker::run() } } catch (const std::exception& e) { DEBUG_LOGF("[RPCWorker] Task threw: %s\n", e.what()); + } catch (...) { + // A raw post() job that throws still loses its MainCb (no worse than the + // std::exception path); this only keeps the worker thread alive. + DEBUG_LOGF("[RPCWorker] Task threw unknown exception\n"); } } }