aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-11-11 17:34:10 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-11-13 11:10:48 +0100
commita264c32e3321ae909ca59cb8ce8bf5d812dbc4e1 (patch)
tree2f934da3736223e127356a496b0bfb6fa4563fca /src/init.cpp
parent3ac70609345a249a74fad61b70f93e8a19245011 (diff)
downloadbitcoin-a264c32e3321ae909ca59cb8ce8bf5d812dbc4e1.tar.xz
http: speed up shutdown
This continues/fixes #6719. `event_base_loopbreak` was not doing what I expected it to, at least in libevent 2.0.21. What I expected was that it sets a timeout, given that no other pending events it would exit in N seconds. However, what it does was delay the event loop exit with 10 seconds, even if nothing is pending. Solve it in a different way: give the event loop thread time to exit out of itself, and if it doesn't, send loopbreak. This speeds up the RPC tests a lot, each exit incurred a 10 second overhead, with this change there should be no shutdown overhead in the common case and up to two seconds if the event loop is blocking. As a bonus this breaks dependency on boost::thread_group, as the HTTP server minds its own offspring.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 5f2dc8bf2f..b58c47a940 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -661,7 +661,7 @@ bool AppInitServers(boost::thread_group& threadGroup)
return false;
if (GetBoolArg("-rest", false) && !StartREST())
return false;
- if (!StartHTTPServer(threadGroup))
+ if (!StartHTTPServer())
return false;
return true;
}