#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... | |
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) |
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
◆ cancelReservation()
void statefulhelper::cancelReservation | ( | const Helper::ReservationId | reservation | ) |
Definition at line 610 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 874 of file helper.cc.
References DBG_CRITICAL, DBG_IMPORTANT, debugs, Debug::Extra(), fatalf(), and squid_curtime.
Referenced by helperOpenServers(), and helperStatefulOpenServers().
◆ 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 856 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.
Referenced by helper_stateful_server::HelperServerClosed(), and Helper::Session::HelperServerClosed().
◆ Make()
|
static |
◆ nextRequest()
|
inherited |
- Returns
- next request in the queue, or nil.
Definition at line 1297 of file helper.cc.
References Ping::stats.
Referenced by helperKickQueue(), and helperStatefulKickQueue().
◆ overloaded()
|
protectedinherited |
Definition at line 498 of file helper.cc.
References Ping::stats.
◆ packStatsInto()
|
inherited |
Definition at line 689 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 531 of file helper.cc.
References Helper::ChildConfig::actDie, DBG_IMPORTANT, debugs, fatalf(), and squid_curtime.
◆ queueFull()
|
protectedinherited |
Definition at line 493 of file helper.cc.
References Ping::stats.
◆ reserveServer()
void statefulhelper::reserveServer | ( | helper_stateful_server * | srv | ) |
Definition at line 597 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().
◆ submit() [1/2]
|
protectedinherited |
◆ submit() [2/2]
|
private |
Definition at line 657 of file helper.cc.
References Helper::Request::callback, Helper::Request::data, 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 460 of file helper.cc.
References Enqueue(), GetFirstAvailable(), and helperDispatch().
Referenced by helperReturnBuffer().
◆ syncQueueStats()
|
protectedinherited |
Definition at line 504 of file helper.cc.
References DBG_IMPORTANT, debugs, and squid_curtime.
◆ trySubmit() [1/2]
|
inherited |
Definition at line 558 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 747 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 |
Definition at line 110 of file helper.h.
Referenced by helperOpenServers(), and helperStatefulOpenServers().
◆ childs
|
inherited |
Definition at line 108 of file helper.h.
Referenced by Enqueue(), GetFirstAvailable(), helperOpenServers(), helperReturnBuffer(), helperShutdown(), helperStatefulOpenServers(), helperStatefulShutdown(), StatefulEnqueue(), and StatefulGetFirstAvailable().
◆ cmdline
|
inherited |
Definition at line 104 of file helper.h.
Referenced by helperOpenServers(), and helperStatefulOpenServers().
◆ droppedRequests
◆ eom
◆ id_name
|
inherited |
Definition at line 107 of file helper.h.
Referenced by Enqueue(), helperReturnBuffer(), helperShutdown(), helperStatefulServerDone(), helperStatefulShutdown(), and StatefulEnqueue().
◆ ipc_type
|
inherited |
Definition at line 109 of file helper.h.
Referenced by helperOpenServers(), and helperStatefulOpenServers().
◆ last_queue_warn
|
inherited |
Definition at line 113 of file helper.h.
Referenced by Enqueue(), and StatefulEnqueue().
◆ last_restart
|
inherited |
Definition at line 114 of file helper.h.
Referenced by helperOpenServers(), and helperStatefulOpenServers().
◆ onTimedOutResponse
◆ overloadStart
◆ queue
|
inherited |
Definition at line 106 of file helper.h.
Referenced by Enqueue(), and StatefulEnqueue().
◆ reservations
|
private |
◆ retryBrokenHelper
◆ retryTimedOut
|
inherited |
Definition at line 116 of file helper.h.
Referenced by helperReturnBuffer().
◆ servers
|
inherited |
Definition at line 105 of file helper.h.
Referenced by GetFirstAvailable(), helperOpenServers(), helperShutdown(), helperStatefulOpenServers(), helperStatefulShutdown(), and StatefulGetFirstAvailable().
◆ stats
|
inherited |
Referenced by Enqueue(), helperReturnBuffer(), and StatefulEnqueue().
◆ timeout
|
inherited |
Definition at line 115 of file helper.h.
Referenced by helperOpenServers(), and helperReturnBuffer().
The documentation for this class was generated from the following files: