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:
Wladimir J. van der Laan
2015-08-28 16:55:16 +02:00
committed by Jack Grigg
parent 9fb5b94e64
commit 116503c0b8
3 changed files with 26 additions and 11 deletions

View File

@@ -677,7 +677,7 @@ bool AppInitServers(boost::thread_group& threadGroup)
{
RPCServer::OnStopped(&OnRPCStopped);
RPCServer::OnPreCommand(&OnRPCPreCommand);
if (!StartHTTPServer(threadGroup))
if (!InitHTTPServer())
return false;
if (!StartRPC())
return false;
@@ -685,6 +685,8 @@ bool AppInitServers(boost::thread_group& threadGroup)
return false;
if (GetBoolArg("-rest", false) && !StartREST())
return false;
if (!StartHTTPServer(threadGroup))
return false;
return true;
}