mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
refactor: Remove call to ShutdownRequested from HTTPRequest
Pass HTTP server an interrupt object instead of having it depend on shutdown.h and global shutdown state. There is no change in behavior in this commit.
This commit is contained in:
parent
73133c36aa
commit
42e5829d97
4 changed files with 19 additions and 10 deletions
|
|
@ -9,6 +9,10 @@
|
|||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace util {
|
||||
class SignalInterrupt;
|
||||
} // namespace util
|
||||
|
||||
static const int DEFAULT_HTTP_THREADS=4;
|
||||
static const int DEFAULT_HTTP_WORKQUEUE=16;
|
||||
static const int DEFAULT_HTTP_SERVER_TIMEOUT=30;
|
||||
|
|
@ -21,7 +25,7 @@ class HTTPRequest;
|
|||
/** Initialize HTTP server.
|
||||
* Call this before RegisterHTTPHandler or EventBase().
|
||||
*/
|
||||
bool InitHTTPServer();
|
||||
bool InitHTTPServer(const util::SignalInterrupt& interrupt);
|
||||
/** Start HTTP server.
|
||||
* This is separate from InitHTTPServer to give users race-condition-free time
|
||||
* to register their handlers between InitHTTPServer and StartHTTPServer.
|
||||
|
|
@ -57,10 +61,11 @@ class HTTPRequest
|
|||
{
|
||||
private:
|
||||
struct evhttp_request* req;
|
||||
const util::SignalInterrupt& m_interrupt;
|
||||
bool replySent;
|
||||
|
||||
public:
|
||||
explicit HTTPRequest(struct evhttp_request* req, bool replySent = false);
|
||||
explicit HTTPRequest(struct evhttp_request* req, const util::SignalInterrupt& interrupt, bool replySent = false);
|
||||
~HTTPRequest();
|
||||
|
||||
enum RequestMethod {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue