limit = app->Settings().m_ShutdownIfTooManyOpenFD;
58 intproc_fd_soft_limit;
59 intproc_fd_hard_limit;
64 if(proc_fd_used < limit)
67 #if H2O_VERSION_MAJOR == 2 && H2O_VERSION_MINOR >= 3 71 ERR_POST(
Fatal<<
"The file descriptor usage limit has reached. Currently in use: "+
72to_string(proc_fd_used) +
" Limit: "+ to_string(limit) +
73 " Exit immediately.");
77 PSG_CRITICAL(
"The file descriptor usage limit has reached. Currently in use: "+
78to_string(proc_fd_used) +
" Limit: "+ to_string(limit));
81 autonow = psg_clock_t::now();
82 autoexpiration = now + chrono::seconds(2);
92 PSG_CRITICAL(
"Auto shutdown within 2 seconds is initiated.");
99 #if H2O_VERSION_MAJOR == 2 && H2O_VERSION_MINOR >= 3 100 #include <h2o/http2_internal.h> 101h2o_socket_t * Geth2oConnectionSocketForRequest(h2o_req_t * req)
110h2o_http2_conn_t * conn_http2 = (h2o_http2_conn_t * )req->conn;
111 returnconn_http2->sock;
130uv_close_cb close_cb)
133 #if H2O_VERSION_MAJOR == 2 && H2O_VERSION_MINOR >= 3 134h2o_socket_t * sock = h2o_uv_socket_create((uv_handle_t*)
conn, close_cb);
136h2o_socket_t * sock = h2o_uv_socket_create(
conn, close_cb);
140 PSG_ERROR(
"h2o layer failed to create socket");
141uv_close((uv_handle_t*)
conn, close_cb);
150 if(uv_fileno(
reinterpret_cast<uv_handle_t*
>(
conn), &fd) == 0) {
152 structlinger linger = {0, 0};
155setsockopt(fd, IPPROTO_TCP, TCP_LINGER2, &no,
157setsockopt(fd, SOL_SOCKET, SO_LINGER, &linger,
159setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &keepalive,
163sock->on_close.data = http_conn;
187 for(
auto& it: lst) {
189std::get<1>(it).OnTimer();
197 for(
auto& it: lst) {
198std::get<1>(it).PeekAsync(
true);
207reply->PrepareReplyMessage(
msg,
213reply->SetCompleted();
221h2o_conn_t *
conn= req->conn;
222 #if H2O_VERSION_MAJOR == 2 && H2O_VERSION_MINOR >= 3 223h2o_socket_t * sock = Geth2oConnectionSocketForRequest(req);
225h2o_socket_t * sock =
conn->callbacks->get_socket(
conn);
228 assert(sock->on_close.data !=
nullptr);
235unique_ptr<CHttpReply> low_level_reply(
238shared_ptr<CPSGS_Reply> reply(
new CPSGS_Reply(std::move(low_level_reply)));
249 switch(reply->GetHttpReply()->GetState()) {
260 string msg=
"Logic error: unknown CHttpReply state ("+
261to_string(
static_cast<int>(reply->GetHttpReply()->GetState()))
267}
catch(
conststd::exception & e) {
271 PSG_ERROR(
"Exception while invoking an http request handler: "<< e);
272 if(!reply->IsFinished()) {
279 PSG_ERROR(
"Unknown exception while invoking an http request handler");
280 if(!reply->IsFinished()) {
void OnClientClosedConnection(void)
static void s_OnBeforeClosedConnection(void *data)
h2o_context_t * InitializeH2oHttpContext(uv_loop_t *loop, CHttpDaemon &http_daemon, h2o_socket_t *sock)
void OnAsyncWork(bool cancel)
int OnHttpRequest(CHttpGateHandler *rh, h2o_req_t *req, const char *cd_uid)
void ThreadStart(uv_loop_t *loop, CTcpWorker *worker)
void OnClientClosedConnection(uv_stream_t *conn, CHttpConnection *http_conn)
void OnNewConnection(uv_stream_t *conn, CHttpConnection *http_conn, uv_close_cb close_cb)
void SetPostParser(CHttpPostParser *parser)
void SetGetParser(CHttpRequestParser *parser)
static CPubseqGatewayApp * GetInstance(void)
static CS_CONNECTION * conn
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
@ eDiag_Error
Error message.
@ e503_ServiceUnavailable
void Fatal(CExceptionArgs_Base &args)
static int GetFileDescriptorsCount(int *soft_limit=NULL, int *hard_limit=NULL)
Get the number of file descriptors consumed by the current process, and optional system wide file des...
SShutdownData g_ShutdownData
static void FinishReply503(shared_ptr< CPSGS_Reply > reply, const string &msg)
Defines process management classes.
#define PSG_ERROR(message)
#define PSG_CRITICAL(message)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
CHttpPostParser * m_PostParser
CHttpRequestParser * m_GetParser
HttpHandlerFunction_t * m_Handler
std::list< std::tuple< uv_tcp_t, CHttpConnection > > & GetConnList(void)
atomic_bool m_ShutdownRequested
psg_time_point_t m_Expired
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4