mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
Fix race condition between starting HTTP server thread and setting EventBase()
Split StartHTTPServer into InitHTTPServer and StartHTTPServer to give clients a window to register their handlers without race conditions. Thanks @ajweiss for figuring this out.
This commit is contained in:
@@ -618,7 +618,7 @@ bool AppInitServers(boost::thread_group& threadGroup)
|
||||
{
|
||||
RPCServer::OnStopped(&OnRPCStopped);
|
||||
RPCServer::OnPreCommand(&OnRPCPreCommand);
|
||||
if (!StartHTTPServer(threadGroup))
|
||||
if (!InitHTTPServer())
|
||||
return false;
|
||||
if (!StartRPC())
|
||||
return false;
|
||||
@@ -626,6 +626,8 @@ bool AppInitServers(boost::thread_group& threadGroup)
|
||||
return false;
|
||||
if (GetBoolArg("-rest", false) && !StartREST())
|
||||
return false;
|
||||
if (!StartHTTPServer(threadGroup))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user