represents a single "stateless helper" process More...
#include <helper.h>


Public Types | |
typedef std::map< uint64_t, Requests::iterator > | RequestIndex |
typedef std::list< Helper::Xaction * > | Requests |
Public Member Functions | |
~helper_server () override | |
Helper::Xaction * | popRequest (int requestId) |
void | checkForTimedOutRequests (bool const retry) |
bool | reserved () override |
whether the server is locked for exclusive use by a client More... | |
void | dropQueued () override |
dequeues and sends a Helper::Unknown answer to all queued requests More... | |
helper * | getParent () const override |
the helper object that created this server More... | |
void | closePipesSafely (const char *name) |
void | closeWritePipeSafely (const char *name) |
void | initStats () |
virtual void * | toCbdata ()=0 |
Static Public Member Functions | |
static void | requestTimeout (const CommTimeoutCbParams &io) |
Read timeout handler. More... | |
static void | HelperServerClosed (helper_server *srv) |
close handler to handle exited server processes More... | |
Public Attributes | |
uint64_t | nextRequestId |
MemBuf * | wqueue |
MemBuf * | writebuf |
helper * | parent |
Helper::Xaction * | replyXaction |
bool | ignoreToEom |
Whether to ignore current message, because it is timed-out or other reason. More... | |
RequestIndex | requestsIndex |
maps request IDs to requests More... | |
const InstanceId< HelperServerBase > | index |
int | pid |
Ip::Address | addr |
Comm::ConnectionPointer | readPipe |
Comm::ConnectionPointer | writePipe |
void * | hIpc |
char * | rbuf |
size_t | rbuf_sz |
size_t | roffset |
struct timeval | dispatch_time |
struct timeval | answer_time |
dlink_node | link |
struct HelperServerBase::_helper_flags | flags |
Requests | requests |
requests in order of submission/expiration More... | |
struct { | |
uint64_t uses | |
uint64_t replies | |
uint64_t pending | |
uint64_t releases | |
uint64_t timedout | |
} | stats |
Private Member Functions | |
CBDATA_CHILD (helper_server) | |
virtual void | finalizedInCbdataChild ()=0 |
hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More... | |
Detailed Description
Member Typedef Documentation
◆ RequestIndex
typedef std::map<uint64_t, Requests::iterator> helper_server::RequestIndex |
◆ Requests
|
inherited |
Constructor & Destructor Documentation
◆ ~helper_server()
|
override |
Definition at line 152 of file helper.cc.
References assert, cbdataReferenceDone, helper::childs, MemBuf::clean(), HelperServerBase::closeWritePipeSafely(), dlinkDelete(), helper::id_name, Comm::IsConnOpen(), HelperServerBase::link, Helper::ChildConfig::n_running, parent, HelperServerBase::requests, helper::servers, wqueue, writebuf, and HelperServerBase::writePipe.
Member Function Documentation
◆ CBDATA_CHILD()
|
private |
◆ checkForTimedOutRequests()
void helper_server::checkForTimedOutRequests | ( | bool const | retry | ) |
Run over the active requests lists and forces a retry, or timedout reply or the configured "on timeout response" for timedout requests.
Definition at line 1517 of file helper.cc.
References Helper::Reply::accumulate(), assert, Helper::Request::callback, cbdataReferenceValid(), cbdataReferenceValidDone, helper::childs, Helper::ChildConfig::concurrency, Helper::Request::data, debugs, Helper::Reply::finalize(), Helper::Request::Id, SBuf::isEmpty(), SBuf::length(), MAX_RETRIES, helper::onTimedOutResponse, parent, SBuf::rawContent(), Helper::Xaction::reply, Helper::Xaction::request, HelperServerBase::requests, requestsIndex, Helper::Reply::result, Helper::Request::retries, helper::stats, HelperServerBase::stats, helper::submitRequest(), helper::_stats::timedout, Helper::TimedOut, and helper::timeout.
Referenced by helperReturnBuffer(), and requestTimeout().
◆ closePipesSafely()
|
inherited |
Closes pipes to the helper safely. Handles the case where the read and write pipes are the same FD.
- Parameters
-
name displayed for the helper being shutdown if logging an error
Definition at line 74 of file helper.cc.
References Comm::Connection::close(), HelperServerBase::_helper_flags::closing, DBG_IMPORTANT, debugs, Comm::Connection::fd, HelperServerBase::flags, getCurrentTime(), HelperServerBase::hIpc, HelperServerBase::index, HelperServerBase::pid, HelperServerBase::readPipe, and HelperServerBase::writePipe.
Referenced by helperHandleRead(), helperReturnBuffer(), helperShutdown(), helperStatefulHandleRead(), and helperStatefulShutdown().
◆ closeWritePipeSafely()
|
inherited |
Closes the reading pipe. If the read and write sockets are the same the write pipe will also be closed. Otherwise its left open for later handling.
- Parameters
-
name displayed for the helper being shutdown if logging an error
Definition at line 102 of file helper.cc.
References Comm::Connection::close(), HelperServerBase::_helper_flags::closing, DBG_IMPORTANT, debugs, Comm::Connection::fd, HelperServerBase::flags, getCurrentTime(), HelperServerBase::hIpc, HelperServerBase::index, HelperServerBase::pid, HelperServerBase::readPipe, and HelperServerBase::writePipe.
Referenced by ~helper_server(), helper_stateful_server::~helper_stateful_server(), helperReturnBuffer(), and helperStatefulServerDone().
◆ dropQueued()
|
overridevirtual |
Reimplemented from HelperServerBase.
Definition at line 176 of file helper.cc.
References HelperServerBase::dropQueued(), and requestsIndex.
Referenced by HelperServerClosed().
◆ finalizedInCbdataChild()
|
privatepure virtualinherited |
◆ getParent()
|
inlineoverridevirtual |
Implements HelperServerBase.
Definition at line 283 of file helper.h.
References parent.
Referenced by HelperServerClosed().
◆ HelperServerClosed()
|
static |
Definition at line 857 of file helper.cc.
References DBG_IMPORTANT, debugs, dropQueued(), getParent(), helper::handleKilledServer(), and helperOpenServers().
Referenced by helperOpenServers().
◆ initStats()
|
inherited |
Definition at line 64 of file helper.cc.
References HelperServerBase::stats.
Referenced by helperOpenServers(), and helperStatefulOpenServers().
◆ popRequest()
Helper::Xaction * helper_server::popRequest | ( | int | requestId | ) |
Search in queue for the request with requestId, return the related Xaction object and remove it from queue. If concurrency is disabled then the requestId is ignored and the Xaction of the next request in queue is retrieved.
Definition at line 893 of file helper.cc.
References helper::childs, Helper::ChildConfig::concurrency, parent, HelperServerBase::requests, and requestsIndex.
Referenced by helperHandleRead().
◆ requestTimeout()
|
static |
Definition at line 1556 of file helper.cc.
References checkForTimedOutRequests(), commCbCall(), commSetConnTimeout(), CommCommonCbParams::conn, CommCommonCbParams::data, debugs, max(), parent, HelperServerBase::requests, requestTimeout(), helper::retryTimedOut, squid_curtime, and helper::timeout.
Referenced by helperOpenServers(), and requestTimeout().
◆ reserved()
|
inlineoverridevirtual |
Implements HelperServerBase.
◆ toCbdata()
|
pure virtualinherited |
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
Member Data Documentation
◆ addr
|
inherited |
Definition at line 206 of file helper.h.
Referenced by helperOpenServers(), and helperStatefulOpenServers().
◆ answer_time
|
inherited |
Definition at line 216 of file helper.h.
Referenced by helperReturnBuffer(), helperStatefulHandleRead(), and helper::packStatsInto().
◆ dispatch_time
|
inherited |
Definition at line 215 of file helper.h.
Referenced by helperReturnBuffer(), helperStatefulDispatch(), helperStatefulHandleRead(), and helper::packStatsInto().
◆ flags
|
inherited |
Referenced by HelperServerBase::closePipesSafely(), HelperServerBase::closeWritePipeSafely(), GetFirstAvailable(), helper::handleKilledServer(), helperDispatch(), helperDispatchWriteDone(), helperReturnBuffer(), helperShutdown(), helperStatefulServerDone(), helperStatefulShutdown(), helper::packStatsInto(), and StatefulGetFirstAvailable().
◆ hIpc
|
inherited |
Definition at line 209 of file helper.h.
Referenced by HelperServerBase::closePipesSafely(), HelperServerBase::closeWritePipeSafely(), helperOpenServers(), and helperStatefulOpenServers().
◆ ignoreToEom
bool helper_server::ignoreToEom |
Definition at line 263 of file helper.h.
Referenced by helperHandleRead(), and helperOpenServers().
◆ index
|
inherited |
Helper program identifier; does not change when contents do, including during assignment
Definition at line 204 of file helper.h.
Referenced by helper_stateful_server::clearReservation(), HelperServerBase::closePipesSafely(), HelperServerBase::closeWritePipeSafely(), GetFirstAvailable(), helper::handleKilledServer(), helperDispatch(), helperDispatchWriteDone(), helperHandleRead(), helperReturnBuffer(), helperShutdown(), helperStatefulDispatch(), helperStatefulHandleRead(), helperStatefulKickQueue(), helperStatefulShutdown(), helper::packStatsInto(), helper_stateful_server::reserve(), and StatefulGetFirstAvailable().
◆ link
|
inherited |
Definition at line 218 of file helper.h.
Referenced by ~helper_server(), helper_stateful_server::~helper_stateful_server(), helperOpenServers(), and helperStatefulOpenServers().
◆ nextRequestId
uint64_t helper_server::nextRequestId |
Definition at line 249 of file helper.h.
Referenced by helperDispatch(), and helperOpenServers().
◆ parent
helper* helper_server::parent |
Definition at line 254 of file helper.h.
Referenced by ~helper_server(), checkForTimedOutRequests(), getParent(), helperDispatch(), helperDispatchWriteDone(), helperHandleRead(), helperOpenServers(), helperReturnBuffer(), popRequest(), and requestTimeout().
◆ pending
|
inherited |
Definition at line 232 of file helper.h.
Referenced by GetFirstAvailable(), helperDispatch(), helperHandleRead(), helperReturnBuffer(), helperShutdown(), helperStatefulDispatch(), helperStatefulHandleRead(), helperStatefulServerDone(), helperStatefulShutdown(), helper::packStatsInto(), and StatefulGetFirstAvailable().
◆ pid
|
inherited |
Definition at line 205 of file helper.h.
Referenced by HelperServerBase::closePipesSafely(), HelperServerBase::closeWritePipeSafely(), helperOpenServers(), helperStatefulOpenServers(), and helper::packStatsInto().
◆ rbuf
|
inherited |
Definition at line 211 of file helper.h.
Referenced by HelperServerBase::~HelperServerBase(), helperHandleRead(), helperOpenServers(), helperStatefulHandleRead(), and helperStatefulOpenServers().
◆ rbuf_sz
|
inherited |
Definition at line 212 of file helper.h.
Referenced by HelperServerBase::~HelperServerBase(), helperHandleRead(), helperOpenServers(), helperReturnBuffer(), helperStatefulHandleRead(), and helperStatefulOpenServers().
◆ readPipe
|
inherited |
Definition at line 207 of file helper.h.
Referenced by HelperServerBase::closePipesSafely(), HelperServerBase::closeWritePipeSafely(), helperHandleRead(), helperOpenServers(), helperStatefulHandleRead(), helperStatefulOpenServers(), and helper::packStatsInto().
◆ releases
◆ replies
|
inherited |
Definition at line 231 of file helper.h.
Referenced by helper::handleKilledServer(), helperReturnBuffer(), helperStatefulHandleRead(), and helper::packStatsInto().
◆ replyXaction
Helper::Xaction* helper_server::replyXaction |
The helper request Xaction object for the current reply . A helper reply may be distributed to more than one of the retrieved packets from helper. This member stores the Xaction object as long as the end-of-message for current reply is not retrieved.
Definition at line 260 of file helper.h.
Referenced by helperHandleRead(), helperOpenServers(), and helperReturnBuffer().
◆ requests
|
inherited |
Definition at line 227 of file helper.h.
Referenced by ~helper_server(), helper_stateful_server::~helper_stateful_server(), checkForTimedOutRequests(), HelperServerBase::dropQueued(), helperDispatch(), helperStatefulDispatch(), helperStatefulHandleRead(), helper::packStatsInto(), popRequest(), and requestTimeout().
◆ requestsIndex
RequestIndex helper_server::requestsIndex |
Definition at line 267 of file helper.h.
Referenced by checkForTimedOutRequests(), dropQueued(), helperDispatch(), and popRequest().
◆ roffset
|
inherited |
Definition at line 213 of file helper.h.
Referenced by helperHandleRead(), helperOpenServers(), helperStatefulHandleRead(), helperStatefulOpenServers(), and helper::packStatsInto().
◆
struct { ... } HelperServerBase::stats |
Referenced by checkForTimedOutRequests(), helper_stateful_server::clearReservation(), GetFirstAvailable(), helper::handleKilledServer(), helperDispatch(), helperHandleRead(), helperReturnBuffer(), helperShutdown(), helperStatefulDispatch(), helperStatefulHandleRead(), helperStatefulServerDone(), helperStatefulShutdown(), HelperServerBase::initStats(), helper::packStatsInto(), and StatefulGetFirstAvailable().
◆ timedout
|
inherited |
Definition at line 234 of file helper.h.
Referenced by helperHandleRead(), and helper::packStatsInto().
◆ uses
|
inherited |
Definition at line 230 of file helper.h.
Referenced by helperDispatch(), helperStatefulDispatch(), and helper::packStatsInto().
◆ wqueue
MemBuf* helper_server::wqueue |
Definition at line 251 of file helper.h.
Referenced by ~helper_server(), helperDispatch(), helperDispatchWriteDone(), and helperOpenServers().
◆ writebuf
MemBuf* helper_server::writebuf |
Definition at line 252 of file helper.h.
Referenced by ~helper_server(), helperDispatch(), and helperDispatchWriteDone().
◆ writePipe
|
inherited |
Definition at line 208 of file helper.h.
Referenced by ~helper_server(), helper_stateful_server::~helper_stateful_server(), HelperServerBase::closePipesSafely(), HelperServerBase::closeWritePipeSafely(), helperDispatch(), helperDispatchWriteDone(), helperOpenServers(), helperStatefulDispatch(), and helperStatefulOpenServers().
The documentation for this class was generated from the following files: