#include <helper.h>
Public Types | |
using | Pointer = RefCount< statefulhelper > |
typedef std::unordered_map< Helper::ReservationId, helper_stateful_server * > | Reservations |
Public Member Functions | |
~statefulhelper () override=default | |
void | reserveServer (helper_stateful_server *srv) |
reserve the given server More... | |
void | cancelReservation (const Helper::ReservationId reservation) |
undo reserveServer(), clear the reservation and kick the queue More... | |
void | openSessions () override |
Xaction * | nextRequest () |
bool | trySubmit (const char *buf, HLPCB *callback, void *data) |
If possible, submit request. Otherwise, either kill Squid or return false. More... | |
void | submitRequest (Xaction *) |
void | packStatsInto (Packable *p, const char *label=nullptr) const |
Dump some stats about the helper state to a Packable object. More... | |
bool | willOverload () const |
void | handleKilledServer (SessionBase *, bool &needsNewServers) |
void | handleFewerServers (bool madeProgress) |
void | callBack (Xaction &) |
sends transaction response to the transaction initiator More... | |
void | sessionClosed (SessionBase &) |
handles exited helper process More... | |
Static Public Member Functions | |
static Pointer | Make (const char *name) |
Public Attributes | |
wordlist * | cmdline = nullptr |
dlink_list | servers |
std::queue< Xaction * > | queue |
const char * | id_name = nullptr |
ChildConfig | childs |
Configuration settings for number running. More... | |
int | ipc_type = 0 |
Ip::Address | addr |
unsigned int | droppedRequests = 0 |
requests not sent during helper overload More... | |
time_t | overloadStart = 0 |
when the helper became overloaded (zero if it is not) More... | |
time_t | last_queue_warn = 0 |
time_t | last_restart = 0 |
time_t | timeout = 0 |
Requests timeout. More... | |
bool | retryTimedOut = false |
Whether the timed-out requests must retried. More... | |
bool | retryBrokenHelper = false |
Whether the requests must retried on BH replies. More... | |
SBuf | onTimedOutResponse |
The response to use when helper response timedout. More... | |
char | eom = '\n' |
The char which marks the end of (response) message, normally ' '. More... | |
struct Helper::Client::_stats | stats |
Protected Member Functions | |
bool | queueFull () const |
whether queuing an additional request would overload the helper More... | |
bool | overloaded () const |
void | syncQueueStats () |
synchronizes queue-dependent measurements with the current queue state More... | |
bool | prepSubmit () |
void | submit (const char *buf, HLPCB *callback, void *data) |
dispatches or enqueues a helper requests; does not enforce queue limits More... | |
Private Member Functions | |
statefulhelper (const char *const name) | |
helper_stateful_server * | findServer (const Helper::ReservationId &reservation) |
void | submit (const char *buf, HLPCB *callback, void *data, const Helper::ReservationId &reservation) |
bool | trySubmit (const char *buf, HLPCB *callback, void *data, const Helper::ReservationId &reservation) |
reserved servers indexed by reservation IDs More... | |
Private Attributes | |
Reservations | reservations |
Friends | |
void | helperStatefulSubmit (const statefulhelper::Pointer &, const char *buf, HLPCB *, void *cbData, const Helper::ReservationId &) |
Detailed Description
Member Typedef Documentation
◆ Pointer
◆ Reservations
typedef std::unordered_map<Helper::ReservationId, helper_stateful_server *> statefulhelper::Reservations |
Constructor & Destructor Documentation
◆ ~statefulhelper()
|
overridedefault |
◆ statefulhelper()
|
inlineexplicitprivate |
Member Function Documentation
◆ callBack()
|
inherited |
Definition at line 572 of file helper.cc.
References Assure, Helper::Request::callback, cbdataReferenceValidDone, Helper::Request::data, Helper::Xaction::reply, and Helper::Xaction::request.
Referenced by Helper::SessionBase::dropQueued(), and helperReturnBuffer().
◆ cancelReservation()
void statefulhelper::cancelReservation | ( | const Helper::ReservationId | reservation | ) |
Definition at line 617 of file helper.cc.
References asyncCall(), cbdataDialer(), helper_stateful_server::clearReservation(), helperStatefulServerDone(), and ScheduleCallHere.
◆ findServer()
|
private |
◆ handleFewerServers()
|
inherited |
Reacts to unexpected helper process death(s), including a failure to start helper(s) and an unexpected exit of a previously started helper.
- See also
- handleKilledServer()
- Parameters
-
madeProgress whether the died helper(s) responded to any requests
Definition at line 881 of file helper.cc.
References DBG_CRITICAL, DBG_IMPORTANT, debugs, Debug::Extra(), fatalf(), and squid_curtime.
◆ handleKilledServer()
|
inherited |
Updates internal statistics and starts new helper processes after an unexpected server exit
- Parameters
-
needsNewServers true if new helper(s) must be started, false otherwise
Definition at line 863 of file helper.cc.
References assert, DBG_CRITICAL, debugs, Helper::SessionBase::flags, Helper::SessionBase::index, Helper::SessionBase::replies, Helper::SessionBase::_helper_flags::shutdown, and Helper::SessionBase::stats.
◆ Make()
|
static |
◆ nextRequest()
|
inherited |
- Returns
- next request in the queue, or nil.
Definition at line 1295 of file helper.cc.
References Ping::stats.
Referenced by helperKickQueue(), and helperStatefulKickQueue().
◆ openSessions()
|
overridevirtual |
Starts required helper process(es). The caller is responsible for checking that new processes are needed.
Reimplemented from Helper::Client.
Definition at line 329 of file helper.cc.
References Helper::SessionBase::addr, assert, asyncCall(), cbdataDialer(), comm_add_close_handler(), comm_read(), commCbCall(), commSetNonBlocking(), DBG_CRITICAL, DBG_IMPORTANT, debugs, dlinkAddTail(), Comm::Connection::fd, FD_DESC_SZ, fd_note(), getCurrentTime(), HELPER_MAX_ARGS, helper_stateful_server::HelperServerClosed(), helperStatefulHandleRead, helperStatefulKickQueue(), Helper::SessionBase::hIpc, hIpc, Helper::SessionBase::initStats(), ipcCreate(), Helper::SessionBase::link, memAllocBuf(), wordlist::next, helper_stateful_server::parent, Helper::SessionBase::pid, pid, progname, Helper::SessionBase::rbuf, Helper::SessionBase::rbuf_sz, ReadBufSize(), Helper::SessionBase::readPipe, helper_stateful_server::reservationStart, Helper::SessionBase::roffset, safe_free, squid_curtime, Helper::SessionBase::writePipe, xmalloc, and xstrdup.
Referenced by StatefulEnqueue().
◆ overloaded()
|
protectedinherited |
Definition at line 493 of file helper.cc.
References Ping::stats.
◆ packStatsInto()
|
inherited |
Definition at line 696 of file helper.cc.
References Packable::append(), Packable::appendf(), assert, current_time, int, dlink_node::next, PRIu64, Format::QuoteMimeBlob(), Ping::stats, and tvSubMsec().
Referenced by authenticateNegotiateStats(), and authenticateNTLMStats().
◆ prepSubmit()
|
protectedinherited |
prepares the helper for request submission returns true if and only if the submission should proceed may kill Squid if the helper remains overloaded for too long
Definition at line 526 of file helper.cc.
References Helper::ChildConfig::actDie, DBG_IMPORTANT, debugs, fatalf(), and squid_curtime.
◆ queueFull()
|
protectedinherited |
Definition at line 488 of file helper.cc.
References Ping::stats.
◆ reserveServer()
void statefulhelper::reserveServer | ( | helper_stateful_server * | srv | ) |
Definition at line 604 of file helper.cc.
References helper_stateful_server::clearReservation(), helper_stateful_server::reservationId, helper_stateful_server::reserve(), and helper_stateful_server::reserved().
Referenced by helperStatefulKickQueue().
◆ sessionClosed()
|
inherited |
Definition at line 901 of file helper.cc.
References DBG_IMPORTANT, and debugs.
Referenced by helper_stateful_server::HelperServerClosed(), and Helper::Session::HelperServerClosed().
◆ submit() [1/2]
|
protectedinherited |
◆ submit() [2/2]
|
private |
Definition at line 664 of file helper.cc.
References DBG_CRITICAL, DBG_DATA, debugs, helperStatefulDispatch(), Helper::Request::placeholder, Helper::Xaction::reply, Helper::Xaction::request, Helper::Reply::result, StatefulEnqueue(), StatefulGetFirstAvailable(), and Helper::TimedOut.
◆ submitRequest()
|
inherited |
Submits a request to the helper or add it to the queue if none of the servers is available.
Definition at line 455 of file helper.cc.
References Enqueue(), GetFirstAvailable(), and helperDispatch().
Referenced by helperReturnBuffer().
◆ syncQueueStats()
|
protectedinherited |
Definition at line 499 of file helper.cc.
References DBG_IMPORTANT, debugs, and squid_curtime.
◆ trySubmit() [1/2]
|
inherited |
Definition at line 553 of file helper.cc.
Referenced by helperSubmit().
◆ trySubmit() [2/2]
|
private |
◆ willOverload()
|
inherited |
whether the helper will be in "overloaded" state after one more request already overloaded helpers return true
Definition at line 754 of file helper.cc.
References GetFirstAvailable().
Friends And Related Function Documentation
◆ helperStatefulSubmit
|
friend |
Submit request or callback the caller with a Helper::Error error. If the reservation is not set then reserves a new helper.
Member Data Documentation
◆ addr
|
inherited |
◆ childs
|
inherited |
Definition at line 118 of file helper.h.
Referenced by Enqueue(), GetFirstAvailable(), helperReturnBuffer(), helperShutdown(), helperStatefulShutdown(), StatefulEnqueue(), and StatefulGetFirstAvailable().
◆ cmdline
◆ droppedRequests
◆ eom
◆ id_name
|
inherited |
Definition at line 117 of file helper.h.
Referenced by Enqueue(), helperReturnBuffer(), helperShutdown(), helperStatefulServerDone(), helperStatefulShutdown(), and StatefulEnqueue().
◆ ipc_type
◆ last_queue_warn
|
inherited |
Definition at line 123 of file helper.h.
Referenced by Enqueue(), and StatefulEnqueue().
◆ last_restart
◆ onTimedOutResponse
◆ overloadStart
◆ queue
|
inherited |
Definition at line 116 of file helper.h.
Referenced by Enqueue(), and StatefulEnqueue().
◆ reservations
|
private |
◆ retryBrokenHelper
◆ retryTimedOut
|
inherited |
Definition at line 126 of file helper.h.
Referenced by helperReturnBuffer().
◆ servers
|
inherited |
Definition at line 115 of file helper.h.
Referenced by GetFirstAvailable(), helperShutdown(), helperStatefulShutdown(), and StatefulGetFirstAvailable().
◆ stats
|
inherited |
Referenced by Enqueue(), helperReturnBuffer(), and StatefulEnqueue().
◆ timeout
|
inherited |
Definition at line 125 of file helper.h.
Referenced by helperReturnBuffer().
The documentation for this class was generated from the following files: