#include <helper.h>


Public Types | |
typedef std::unordered_map< Helper::ReservationId, helper_stateful_server * > | Reservations |
Public Member Functions | |
void * | operator new (size_t size) |
void | operator delete (void *address) |
void * | toCbdata () noexcept |
statefulhelper (const char *name) | |
~statefulhelper () | |
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... | |
Helper::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 (Helper::Xaction *r) |
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 (HelperServerBase *srv, bool &needsNewServers) |
Public Attributes | |
wordlist * | cmdline |
dlink_list | servers |
std::queue< Helper::Xaction * > | queue |
const char * | id_name |
Helper::ChildConfig | childs |
Configuration settings for number running. More... | |
int | ipc_type |
Ip::Address | addr |
unsigned int | droppedRequests |
requests not sent during helper overload More... | |
time_t | overloadStart |
when the helper became overloaded (zero if it is not) More... | |
time_t | last_queue_warn |
time_t | last_restart |
time_t | timeout |
Requests timeout. More... | |
bool | retryTimedOut |
Whether the timed-out requests must retried. More... | |
bool | retryBrokenHelper |
Whether the requests must retried on BH replies. More... | |
SBuf | onTimedOutResponse |
The response to use when helper response timedout. More... | |
char | eom |
The char which marks the end of (response) message, normally ' '. More... | |
struct helper::_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 | |
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 |
Static Private Attributes | |
static cbdata_type | CBDATA_statefulhelper = CBDATA_UNKNOWN |
static cbdata_type | CBDATA_helper = CBDATA_UNKNOWN |
Friends | |
void | helperStatefulSubmit (statefulhelper *hlp, const char *buf, HLPCB *callback, void *data, const Helper::ReservationId &reservation) |
Detailed Description
Member Typedef Documentation
◆ Reservations
typedef std::unordered_map<Helper::ReservationId, helper_stateful_server *> statefulhelper::Reservations |
Constructor & Destructor Documentation
◆ statefulhelper()
◆ ~statefulhelper()
Member Function Documentation
◆ cancelReservation()
void statefulhelper::cancelReservation | ( | const Helper::ReservationId | reservation | ) |
Definition at line 598 of file helper.cc.
References asyncCall(), cbdataDialer(), helper_stateful_server::clearReservation(), helperStatefulServerDone(), reservations, and ScheduleCallHere.
Referenced by helper_stateful_server::~helper_stateful_server(), helperStatefulDispatch(), and helperStatefulHandleRead().
◆ findServer()
|
private |
- Returns
- the previously reserved server (if the reservation is still valid) or nil
Definition at line 614 of file helper.cc.
References reservations.
Referenced by submit().
◆ handleKilledServer()
|
inherited |
Updates interall statistics and start new helper server processes after an unexpected server exit
- Parameters
-
needsNewServers true if new servers must started, false otherwise
Definition at line 833 of file helper.cc.
References assert, helper::childs, DBG_CRITICAL, DBG_IMPORTANT, debugs, fatalf(), HelperServerBase::flags, helper::id_name, HelperServerBase::index, helper::last_restart, Helper::ChildConfig::n_active, Helper::ChildConfig::n_max, Helper::ChildConfig::n_startup, Helper::ChildConfig::needNew(), HelperServerBase::replies, HelperServerBase::_helper_flags::shutdown, squid_curtime, and HelperServerBase::stats.
Referenced by helper_server::HelperServerClosed(), and helper_stateful_server::HelperServerClosed().
◆ nextRequest()
|
inherited |
- Returns
- next request in the queue, or nil.
Definition at line 1261 of file helper.cc.
References helper::queue, helper::_stats::queue_size, and helper::stats.
Referenced by helperKickQueue(), and helperStatefulKickQueue().
◆ operator delete()
|
inline |
◆ operator new()
◆ overloaded()
|
protectedinherited |
Definition at line 486 of file helper.cc.
References helper::childs, helper::_stats::queue_size, Helper::ChildConfig::queue_size, and helper::stats.
Referenced by helper::prepSubmit(), and helper::syncQueueStats().
◆ packStatsInto()
|
inherited |
Definition at line 677 of file helper.cc.
References HelperServerBase::answer_time, Packable::append(), Packable::appendf(), assert, helper::_stats::avg_svc_time, Helper::Request::buf, helper::childs, HelperServerBase::_helper_flags::closing, helper::cmdline, current_time, HelperServerBase::dispatch_time, Helper::Request::dispatch_time, Comm::Connection::fd, HelperServerBase::flags, dlink_list::head, HelperServerBase::index, int, wordlist::key, Helper::ChildConfig::n_active, Helper::ChildConfig::n_max, Helper::ChildConfig::n_running, dlink_node::next, HelperServerBase::pending, HelperServerBase::pid, Helper::Request::placeholder, PRIu64, helper::_stats::queue_size, Format::QuoteMimeBlob(), HelperServerBase::readPipe, helper::_stats::replies, HelperServerBase::replies, Helper::Xaction::request, helper::_stats::requests, HelperServerBase::requests, HelperServerBase::reserved(), HelperServerBase::roffset, helper::servers, HelperServerBase::_helper_flags::shutdown, helper::stats, HelperServerBase::stats, helper::_stats::timedout, HelperServerBase::timedout, tvSubMsec(), HelperServerBase::uses, InstanceId< Class, ValueType >::value, and HelperServerBase::_helper_flags::writing.
Referenced by authenticateBasicStats(), authenticateDigestStats(), authenticateNegotiateStats(), authenticateNTLMStats(), redirectStats(), and storeIdStats().
◆ 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 519 of file helper.cc.
References Helper::ChildConfig::actDie, helper::childs, DBG_IMPORTANT, debugs, helper::droppedRequests, fatalf(), helper::id_name, Helper::ChildConfig::onPersistentOverload, helper::overloaded(), helper::overloadStart, squid_curtime, and helper::syncQueueStats().
Referenced by helper::trySubmit(), and trySubmit().
◆ queueFull()
|
protectedinherited |
Definition at line 481 of file helper.cc.
References helper::childs, helper::_stats::queue_size, Helper::ChildConfig::queue_size, and helper::stats.
Referenced by helper::willOverload().
◆ reserveServer()
void statefulhelper::reserveServer | ( | helper_stateful_server * | srv | ) |
Definition at line 585 of file helper.cc.
References helper_stateful_server::clearReservation(), helper_stateful_server::reservationId, reservations, helper_stateful_server::reserve(), and helper_stateful_server::reserved().
Referenced by helperStatefulKickQueue(), and submit().
◆ submit() [1/2]
|
protectedinherited |
Definition at line 557 of file helper.cc.
References DBG_DATA, debugs, and helper::submitRequest().
Referenced by helper::trySubmit().
◆ submit() [2/2]
|
private |
Definition at line 645 of file helper.cc.
References Helper::Request::callback, Helper::Request::data, DBG_CRITICAL, DBG_DATA, debugs, findServer(), helperStatefulDispatch(), helper::id_name, Helper::Request::placeholder, Helper::Xaction::reply, Helper::Xaction::request, reserveServer(), Helper::Reply::result, StatefulEnqueue(), StatefulGetFirstAvailable(), helper::syncQueueStats(), and Helper::TimedOut.
Referenced by trySubmit().
◆ submitRequest()
|
inherited |
Submits a request to the helper or add it to the queue if none of the servers is available.
Definition at line 446 of file helper.cc.
References Enqueue(), GetFirstAvailable(), helperDispatch(), and helper::syncQueueStats().
Referenced by helper_server::checkForTimedOutRequests(), helperReturnBuffer(), and helper::submit().
◆ syncQueueStats()
|
protectedinherited |
Definition at line 492 of file helper.cc.
References DBG_IMPORTANT, debugs, helper::droppedRequests, helper::id_name, helper::overloaded(), helper::overloadStart, and squid_curtime.
Referenced by helper::prepSubmit(), submit(), and helper::submitRequest().
◆ toCbdata()
◆ trySubmit() [1/2]
|
inherited |
Definition at line 546 of file helper.cc.
References helper::prepSubmit(), and helper::submit().
Referenced by ExternalACLLookup::Start().
◆ trySubmit() [2/2]
|
private |
If possible, submit request. Otherwise, either kill Squid or return false.
Definition at line 575 of file helper.cc.
References helper::prepSubmit(), and submit().
◆ willOverload()
|
inherited |
whether the helper will be in "overloaded" state after one more request already overloaded helpers return true
Definition at line 735 of file helper.cc.
References helper::childs, GetFirstAvailable(), Helper::ChildConfig::needNew(), and helper::queueFull().
Referenced by aclMatchExternal(), redirectStart(), and storeIdStart().
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 |
Definition at line 113 of file helper.h.
Referenced by helperOpenServers(), and helperStatefulOpenServers().
◆ CBDATA_helper
|
staticprivateinherited |
◆ CBDATA_statefulhelper
|
staticprivate |
◆ childs
|
inherited |
Definition at line 111 of file helper.h.
Referenced by helper_server::~helper_server(), helper_stateful_server::~helper_stateful_server(), helper_server::checkForTimedOutRequests(), Enqueue(), GetFirstAvailable(), helper::handleKilledServer(), helperDispatch(), helperHandleRead(), helperOpenServers(), helperReturnBuffer(), helperShutdown(), helperStatefulOpenServers(), helperStatefulShutdown(), Ssl::Helper::Init(), helper::overloaded(), helper::packStatsInto(), helper_server::popRequest(), helper::prepSubmit(), helper::queueFull(), redirectInit(), StatefulEnqueue(), StatefulGetFirstAvailable(), and helper::willOverload().
◆ cmdline
|
inherited |
Definition at line 107 of file helper.h.
Referenced by helperOpenServers(), helperStatefulOpenServers(), Ssl::Helper::Init(), helper::packStatsInto(), and redirectInit().
◆ droppedRequests
|
inherited |
Definition at line 114 of file helper.h.
Referenced by helper::prepSubmit(), and helper::syncQueueStats().
◆ eom
|
inherited |
Definition at line 122 of file helper.h.
Referenced by helperHandleRead(), helperStatefulHandleRead(), and Ssl::Helper::Init().
◆ id_name
|
inherited |
Definition at line 110 of file helper.h.
Referenced by helper::~helper(), helper_server::~helper_server(), helper_stateful_server::~helper_stateful_server(), Enqueue(), helper::handleKilledServer(), helperDispatch(), helperDispatchWriteDone(), helperHandleRead(), helperReturnBuffer(), helperShutdown(), helperStatefulDispatch(), helperStatefulHandleRead(), helperStatefulServerDone(), helperStatefulShutdown(), helper::prepSubmit(), StatefulEnqueue(), submit(), and helper::syncQueueStats().
◆ ipc_type
|
inherited |
Definition at line 112 of file helper.h.
Referenced by helperOpenServers(), helperStatefulOpenServers(), Ssl::Helper::Init(), and redirectInit().
◆ last_queue_warn
|
inherited |
Definition at line 116 of file helper.h.
Referenced by Enqueue(), and StatefulEnqueue().
◆ last_restart
|
inherited |
Definition at line 117 of file helper.h.
Referenced by helper::handleKilledServer(), helperOpenServers(), and helperStatefulOpenServers().
◆ onTimedOutResponse
|
inherited |
Definition at line 121 of file helper.h.
Referenced by helper_server::checkForTimedOutRequests(), and redirectInit().
◆ overloadStart
|
inherited |
Definition at line 115 of file helper.h.
Referenced by helper::prepSubmit(), and helper::syncQueueStats().
◆ queue
|
inherited |
Definition at line 109 of file helper.h.
Referenced by helper::~helper(), Enqueue(), helper::nextRequest(), and StatefulEnqueue().
◆ reservations
|
private |
Definition at line 168 of file helper.h.
Referenced by cancelReservation(), findServer(), and reserveServer().
◆ retryBrokenHelper
|
inherited |
Definition at line 120 of file helper.h.
Referenced by redirectInit().
◆ retryTimedOut
|
inherited |
Definition at line 119 of file helper.h.
Referenced by helperReturnBuffer(), redirectInit(), and helper_server::requestTimeout().
◆ servers
|
inherited |
Definition at line 108 of file helper.h.
Referenced by helper_server::~helper_server(), helper_stateful_server::~helper_stateful_server(), GetFirstAvailable(), helperOpenServers(), helperShutdown(), helperStatefulOpenServers(), helperStatefulShutdown(), helper::packStatsInto(), and StatefulGetFirstAvailable().
◆ stats
|
inherited |
Referenced by helper::helper(), helper::~helper(), helper_server::checkForTimedOutRequests(), Enqueue(), helperDispatch(), helperReturnBuffer(), helperStatefulDispatch(), helperStatefulHandleRead(), helper::nextRequest(), helper::overloaded(), helper::packStatsInto(), helper::queueFull(), and StatefulEnqueue().
◆ timeout
|
inherited |
Definition at line 118 of file helper.h.
Referenced by helper_server::checkForTimedOutRequests(), helperOpenServers(), helperReturnBuffer(), redirectInit(), and helper_server::requestTimeout().
The documentation for this class was generated from the following files: