Improve shutdown process

Zcash: cherry-picked from commit 793667af1c31835e0eefcdd283930bb89cfeda8f
This commit is contained in:
João Barbosa
2017-08-08 13:30:04 +01:00
committed by Jason Davies
parent c98b91b7c5
commit d3c8109b41

View File

@@ -479,6 +479,8 @@ void StopHTTPServer()
}
if (eventBase) {
LogPrint("http", "Waiting for HTTP event thread to exit\n");
// Exit the event loop as soon as there are no active events.
event_base_loopexit(eventBase, nullptr);
// Give event loop a few seconds to exit (to send back last RPC responses), then break it
// Before this was solved with event_base_loopexit, but that didn't work as expected in
// at least libevent 2.0.21 and always introduced a delay. In libevent