mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
http: Release server before waiting for event base loop exit
This commit is contained in:
parent
8c6d007c80
commit
660bdbf785
1 changed files with 9 additions and 6 deletions
|
|
@ -486,15 +486,18 @@ void StopHTTPServer()
|
|||
return g_requests.empty();
|
||||
});
|
||||
}
|
||||
if (eventHTTP) {
|
||||
// Schedule a callback to call evhttp_free in the event base thread, so
|
||||
// that evhttp_free does not need to be called again after the handling
|
||||
// of unfinished request connections that follows.
|
||||
event_base_once(eventBase, -1, EV_TIMEOUT, [](evutil_socket_t, short, void*) {
|
||||
evhttp_free(eventHTTP);
|
||||
eventHTTP = nullptr;
|
||||
}, nullptr, nullptr);
|
||||
}
|
||||
if (eventBase) {
|
||||
LogPrint(BCLog::HTTP, "Waiting for HTTP event thread to exit\n");
|
||||
if (g_thread_http.joinable()) g_thread_http.join();
|
||||
}
|
||||
if (eventHTTP) {
|
||||
evhttp_free(eventHTTP);
|
||||
eventHTTP = nullptr;
|
||||
}
|
||||
if (eventBase) {
|
||||
event_base_free(eventBase);
|
||||
eventBase = nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue