Skip to content

Commit 793667a

Browse files
committed
Improve shutdown process
1 parent fa64636 commit 793667a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/httpserver.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ void StopHTTPServer()
481481
}
482482
if (eventBase) {
483483
LogPrint(BCLog::HTTP, "Waiting for HTTP event thread to exit\n");
484+
// Exit the event loop as soon as there are no active events.
485+
event_base_loopexit(eventBase, nullptr);
484486
// Give event loop a few seconds to exit (to send back last RPC responses), then break it
485487
// Before this was solved with event_base_loopexit, but that didn't work as expected in
486488
// at least libevent 2.0.21 and always introduced a delay. In libevent

0 commit comments

Comments
 (0)