FCGI args for routes
FossilOrigin-Name: 1d55fc7848ed869a304858cd84eae6cca403a916bc831bab7db7a4f6a263d07a
This commit is contained in:
parent
5ee629bec4
commit
10acb813b8
3 changed files with 21 additions and 2 deletions
|
@ -18,6 +18,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
|
||||
#define HINT_UNUSED(var) (void)(var);
|
||||
|
||||
// NOOP for now!
|
||||
|
|
|
@ -92,6 +92,10 @@ int start_wormhole()
|
|||
|
||||
// Passed as std::any to each route function
|
||||
RouteArgs args{database.get()};
|
||||
#ifdef MODULE_FCGI
|
||||
// Set FDs for FCGI http requests
|
||||
args.fcgi_pipe_fds = &pipe_fds;
|
||||
#endif
|
||||
|
||||
// Start HTTPD Server
|
||||
std::unique_ptr<HTTP::Server> server =
|
||||
|
|
|
@ -19,12 +19,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <any>
|
||||
#include <array>
|
||||
#include "database/database.h"
|
||||
#include "common.h"
|
||||
|
||||
#ifdef MODULE_FCGI
|
||||
#define FCGI_PIPE(_arg) std::array<int, 2>* fcgi_pipe_fds = std::any_cast<RouteArgs>(_arg).fcgi_pipe_fds; \
|
||||
HINT_UNUSED(fcgi_pipe_fds);
|
||||
#else
|
||||
#define FCIG_PIPE(_arg) ;
|
||||
#endif
|
||||
|
||||
// Apologies if the word "DESTRUCT" is confusing here, it simply means to cast into regular variables
|
||||
#define DESTRUCT_WORMHOLE_ARGS(_arg) DB::Database* db = std::any_cast<RouteArgs>(_arg).db;
|
||||
#define DESTRUCT_WORMHOLE_ARGS(_arg) DB::Database* db = std::any_cast<RouteArgs>(_arg).db; \
|
||||
HINT_UNUSED(db); \
|
||||
FCGI_PIPE(_arg);
|
||||
|
||||
|
||||
struct RouteArgs
|
||||
{
|
||||
DB::Database* db;
|
||||
#ifdef MODULE_FCGI
|
||||
std::array<int, 2>* fcgi_pipe_fds;
|
||||
#endif
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue