diff options
| author | Wladimir J. van der Laan <[email protected]> | 2015-08-28 16:55:16 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-09-03 10:59:19 +0200 |
| commit | 3a174cd400c6c239539d4c0c10b557c3e0615212 (patch) | |
| tree | 3a7b26b9218f9e3d17d8a3f5f77e032b35f6e416 /src/init.cpp | |
| parent | Document options for new HTTP/RPC server in --help (diff) | |
| download | discoin-3a174cd400c6c239539d4c0c10b557c3e0615212.tar.xz discoin-3a174cd400c6c239539d4c0c10b557c3e0615212.zip | |
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.
Diffstat (limited to 'src/init.cpp')
| -rw-r--r-- | src/init.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp index bbf73dc8f..4aaeee257 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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; } |