app->NotifyRequestFinished(request_id);
85 const string& peer_ip,
86 boolexceed_soft_limit_flag)
116 const string& peer_user_agent)
123 if(
m_PeerId.value() != peer_id) {
191 if(
m_PeerId.value() != peer_id) {
246(*it).m_Reply->GetHttpReply()->CancelPending();
299(*it).m_Reply->GetHttpReply()->CancelPending();
310 if(!chk_data_ready ||
311it.m_Reply->GetHttpReply()->CheckResetDataTriggered()) {
312it.m_Reply->GetHttpReply()->PeekPending();
348shared_ptr<CPSGS_Reply> reply,
349list<string> processor_names)
352 x_Start(request, reply, std::move(processor_names));
357std::move(processor_names),
358psg_clock_t::now()});
364reply->PrepareReplyMessage(
"Too many pending requests",
370reply->SetCompleted();
377shared_ptr<CPSGS_Reply> reply,
378list<string> processor_names)
380 autohttp_reply = reply->GetHttpReply();
381 if(!http_reply->IsPostponed())
383 "Request has not been postponed");
386 "Request handling can not be started after connection was closed");
391list<shared_ptr<IPSGS_Processor>> processors =
392app->GetProcessorDispatcher()->DispatchRequest(request, reply, processor_names);
394 if(processors.empty()) {
400request->SetConcurrentProcessorCount(processors.size());
401 for(
auto& processor : processors) {
402reply->GetHttpReply()->AssignPendingReq(
403unique_ptr<CPendingOperation>(
415 for(
autoreq: http_reply->GetPendingReqs())
416req->SendProcessorStartMessage();
419app->GetProcessorDispatcher()->StartRequestTimer(reply->GetRequestId());
422 for(
autoreq: http_reply->GetPendingReqs())
428shared_ptr<CPSGS_Reply> reply,
429list<string> processor_names)
431 autohttp_reply = reply->GetHttpReply();
432 switch(http_reply->GetState()) {
434 if(http_reply->IsPostponed())
436eRequestAlreadyPostponed,
437 "Request has already been postponed");
441 "Request that has already started " 442 "can't be postponed");
446 "Request has already been finished");
450http_reply->SetPostponed();
459 if(!it.m_Reply->IsFinished()) {
460 autohttp_reply = it.m_Reply->GetHttpReply();
466it.m_Request->SetRequestContext();
467 PSG_WARNING(
"Cancelling running "+ it.m_Request->GetName() +
468 " request (id: "+ to_string(it.m_Request->GetRequestId()) +
469 ") due to closed connection");
472http_reply->CancelPending();
473http_reply->PeekPending();
481shared_ptr<CPSGS_Reply> reply)
490 size_trequest_id = (*it).m_Reply->GetRequestId();
501(*it).m_Reply->GetHttpReply()->ResetPendingRequest();
528shared_ptr<CPSGS_Reply> reply = it->m_Reply;
535it->m_Request->SetRequestContext();
536 PSG_WARNING(
"Cancelling backlogged "+ it->m_Request->GetName() +
537 " request (id: "+ to_string(it->m_Request->GetRequestId()) +
538 ") due to closed connection");
541reply->GetHttpReply()->CancelPending();
551 if((*it).m_Reply->IsCompleted()) {
569shared_ptr<CPSGS_Request> request = backlog_front.m_Request;
570shared_ptr<CPSGS_Reply> reply = backlog_front.m_Reply;
571list<string> processor_names = backlog_front.m_PreliminaryDispatchedProcessors;
583 autonow = psg_clock_t::now();
584mks = chrono::duration_cast<chrono::microseconds>(now - backlog_start).count();
586request->SetBacklogTime(mks);
588 auto context= request->GetRequestContext();
591request->SetRequestContext();
595 x_Start(request, reply, std::move(processor_names));
654uv_close(
reinterpret_cast<uv_handle_t*
>(
m_TcpStream),
671 PSG_ERROR(
"Internal error. The low level libh2o connection pointer " 672 "has been altered.");
void RegisterBackloggedRequest(CPSGS_Request::EPSGS_Type request_type)
void UnregisterBackloggedRequest(CPSGS_Request::EPSGS_Type request_type)
SConnectionRunTimeProperties GetProperties(void) const
void CloseThrottledConnection(EPSGS_ClosingType closing_type)
bool IsClosed(void) const
list< SBacklogAttributes > m_BacklogRequests
void x_MaintainBacklog(void)
void DoScheduledMaintain(void)
void PeekAsync(bool chk_data_ready)
SConnectionRunTimeProperties m_RunTimeProps
void UpdateH2oConnection(h2o_conn_t *h2o_conn)
h2o_conn_t * m_H2oConnection
uv_async_t m_InitiateClosingEvent
void SetupTimers(uv_loop_t *tcp_worker_loop)
list< SRunningAttributes > m_RunningRequests
void x_Start(shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply, list< string > processor_names)
h2o_accept_ctx_t m_HttpAcceptCtx
uv_timer_t m_ScheduledMaintainTimer
void ScheduleMaintain(void)
void x_MaintainFinished(void)
typename list< SRunningAttributes >::iterator running_list_iterator_t
h2o_context_t * InitializeH2oHttpContext(uv_loop_t *loop, CHttpDaemon &http_daemon, h2o_socket_t *sock)
void x_UnregisterBacklog(backlog_list_iterator_t &it)
void x_RegisterPending(shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply, list< string > processor_names)
void x_UnregisterRunning(running_list_iterator_t &it)
void OnBeforeClosedConnection(void)
typename list< SBacklogAttributes >::iterator backlog_list_iterator_t
void x_RegisterRunning(shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply)
void Postpone(shared_ptr< CPSGS_Request > request, shared_ptr< CPSGS_Reply > reply, list< string > processor_names)
void x_CancelBacklog(void)
h2o_globalconf_t * HttpCfg(void)
@ ePSGS_BackloggedRequests
void Increment(IPSGS_Processor *processor, EPSGS_CounterType counter)
CPSGSCounters & GetCounters(void)
static CPubseqGatewayApp * GetInstance(void)
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
CDiagContext_Extra & Print(const string &name, const string &value)
The method does not print the argument, but adds it to the string.
CDiagContext & GetDiagContext(void)
Get diag context instance.
CDiagContext_Extra Extra(void) const
Create a temporary CDiagContext_Extra object.
@ eDiag_Error
Error message.
@ e503_ServiceUnavailable
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void s_OnAsyncConnClose(uv_async_t *handle)
static void IncrementTooManyRequestsCounter(void)
static atomic< bool > s_ConnPropsLock(false)
int64_t GenerateConnectionId(void)
void MaintanTimerCB(uv_timer_t *handle)
static int64_t s_ConnectionId
static void IncrementBackloggedCounter(void)
static void NotifyRequestFinished(size_t request_id)
static atomic< bool > s_ConnectionIdLock(false)
#define PSG_ERROR(message)
#define PSG_WARNING(message)
psg_clock_t::time_point psg_time_point_t
void SetupSSL(h2o_accept_ctx_t *accept_ctx)
static void s_OnClientClosed(uv_handle_t *handle)
optional< string > m_PeerUserAgent
bool m_MovedFromBadToGood
optional< string > m_PeerId
int64_t m_NumFinishedRequests
void UpdatePeerId(const string &peer_id)
bool m_PeerUserAgentMutated
void UpdatePeerUserAgent(const string &peer_user_agent)
size_t m_NumBackloggedRequests
system_clock::time_point m_OpenTimestamp
int64_t m_NumInitiatedRequests
size_t m_NumRunningRequests
optional< system_clock::time_point > m_LastRequestTimestamp
void PrepareForUsage(int64_t conn_cnt_at_open, const string &peer_ip, bool exceed_soft_limit_flag)
void UpdateLastRequestTimestamp(void)
int64_t m_RejectedDueToSoftLimit
bool m_ExceedSoftLimitFlag
SConnectionRunTimeProperties()=default
void UpdatePeerIdAndUserAgent(const string &peer_id, const string &peer_user_agent)
static CS_CONTEXT * context
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