From 6c10037f72073eecc674c313580ef50a4f1e1e44 Mon Sep 17 00:00:00 2001 From: practicalswift Date: Tue, 18 Dec 2018 10:21:06 +0100 Subject: rpc: Fix data race (UB) in InterruptRPC() --- src/rpc/server.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/rpc') diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 733f8601ee..03e1c81132 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -24,7 +24,7 @@ #include static CCriticalSection cs_rpcWarmup; -static bool fRPCRunning = false; +static std::atomic g_rpc_running{false}; static bool fRPCInWarmup GUARDED_BY(cs_rpcWarmup) = true; static std::string rpcWarmupStatus GUARDED_BY(cs_rpcWarmup) = "RPC server started"; /* Timer-creating functions */ @@ -303,7 +303,7 @@ bool CRPCTable::appendCommand(const std::string& name, const CRPCCommand* pcmd) void StartRPC() { LogPrint(BCLog::RPC, "Starting RPC\n"); - fRPCRunning = true; + g_rpc_running = true; g_rpcSignals.Started(); } @@ -311,7 +311,7 @@ void InterruptRPC() { LogPrint(BCLog::RPC, "Interrupting RPC\n"); // Interrupt e.g. running longpolls - fRPCRunning = false; + g_rpc_running = false; } void StopRPC() @@ -324,7 +324,7 @@ void StopRPC() bool IsRPCRunning() { - return fRPCRunning; + return g_rpc_running; } void SetRPCWarmupStatus(const std::string& newStatus) -- cgit v1.2.3