Changeset View
Changeset View
Standalone View
Standalone View
src/httpserver.cpp
Show First 20 Lines • Show All 462 Lines • ▼ Show 20 Lines | void StopHTTPServer() { | ||||
LogPrint(BCLog::HTTP, "Stopping HTTP server\n"); | LogPrint(BCLog::HTTP, "Stopping HTTP server\n"); | ||||
if (workQueue) { | if (workQueue) { | ||||
LogPrint(BCLog::HTTP, "Waiting for HTTP worker threads to exit\n"); | LogPrint(BCLog::HTTP, "Waiting for HTTP worker threads to exit\n"); | ||||
for (auto &thread : g_thread_http_workers) { | for (auto &thread : g_thread_http_workers) { | ||||
thread.join(); | thread.join(); | ||||
} | } | ||||
g_thread_http_workers.clear(); | g_thread_http_workers.clear(); | ||||
delete workQueue; | delete workQueue; | ||||
workQueue = nullptr; | |||||
} | } | ||||
if (eventBase) { | if (eventBase) { | ||||
LogPrint(BCLog::HTTP, "Waiting for HTTP event thread to exit\n"); | LogPrint(BCLog::HTTP, "Waiting for HTTP event thread to exit\n"); | ||||
// Exit the event loop as soon as there are no active events. | // Exit the event loop as soon as there are no active events. | ||||
event_base_loopexit(eventBase, nullptr); | event_base_loopexit(eventBase, nullptr); | ||||
// Give event loop a few seconds to exit (to send back last RPC | // Give event loop a few seconds to exit (to send back last RPC | ||||
// responses), then break it. Before this was solved with | // responses), then break it. Before this was solved with | ||||
// event_base_loopexit, but that didn't work as expected in at least | // event_base_loopexit, but that didn't work as expected in at least | ||||
▲ Show 20 Lines • Show All 189 Lines • Show Last 20 Lines |