diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-09-25 15:35:37 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-09-28 15:06:20 +0200 |
commit | ec908d5f7aa9ad7e3487018e06a24cb6449cc58b (patch) | |
tree | b80a79a74bdd6a0160a2fd76c0bff2d382b85cd7 /src | |
parent | de9de2de361ab1355b976f17371d73e36fe3bf56 (diff) |
http: Force-exit event loop after predefined time
This makes sure that the event loop eventually terminates, even if an
event (like an open timeout, or a hanging connection) happens to be
holding it up.
Diffstat (limited to 'src')
-rw-r--r-- | src/httpserver.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 9f079aedfe..0a7f903e9f 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -457,6 +457,13 @@ void InterruptHTTPServer() // Reject requests on current connections evhttp_set_gencb(eventHTTP, http_reject_request_cb, NULL); } + if (eventBase) { + // Force-exit event loop after predefined time + struct timeval tv; + tv.tv_sec = 10; + tv.tv_usec = 0; + event_base_loopexit(eventBase, &tv); + } if (workQueue) workQueue->Interrupt(); } |