#include <helper.h>
![Inheritance graph](classstatefulhelper__inherit__graph.png)
![Collaboration graph](classstatefulhelper__coll__graph.png)
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 *) |
void | handleFewerServers (bool madeProgress) |
void | dropQueued () |
void | callBack (Xaction &) |
sends transaction response to the transaction initiator 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 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.
◆ dropQueued()
|
inherited |
satisfies all queued requests with a Helper::Unknown answer \prec no existing servers will be able to process queued requests
- See also
- SessionBase::dropQueued()
Definition at line 887 of file helper.cc.
References Assure, DBG_CRITICAL, debugs, GetFirstAvailable(), and Helper::Unknown.
Referenced by helperKickQueue(), helperShutdown(), and helperStatefulKickQueue().
◆ 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 908 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
Definition at line 867 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::SessionBase::HelperServerClosed().
◆ Make()
|
static |
Definition at line 763 of file helper.cc.
References HappyOrderEnforcer::name.
◆ nextRequest()
|
inherited |
- Returns
- next request in the queue, or nil.
Definition at line 1302 of file helper.cc.
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 327 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::SessionBase::HelperServerClosed(), helperStatefulHandleRead, helperStatefulKickQueue(), hIpc, Helper::SessionBase::hIpc, Helper::SessionBase::initStats(), ipcCreate(), Helper::SessionBase::link, memAllocBuf(), wordlist::next, helper_stateful_server::parent, pid, Helper::SessionBase::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()
◆ packStatsInto()
|
inherited |
Definition at line 694 of file helper.cc.
References Packable::append(), Packable::appendf(), assert, current_time, int, dlink_node::next, PRIu64, Format::QuoteMimeBlob(), 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()
◆ 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().
◆ submit() [1/2]
|
protectedinherited |
◆ submit() [2/2]
|
private |
Definition at line 664 of file helper.cc.
References DBG_CRITICAL, debugs, helperStatefulDispatch(), Helper::Xaction::reply, 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 |
If possible, submit request. Otherwise, either kill Squid or return false.
Definition at line 594 of file helper.cc.
Referenced by helperStatefulSubmit().
◆ willOverload()
|
inherited |
whether the helper will be in "overloaded" state after one more request already overloaded helpers return true
Definition at line 752 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 119 of file helper.h.
Referenced by Enqueue(), GetFirstAvailable(), helperKickQueue(), helperReturnBuffer(), helperShutdown(), helperStatefulKickQueue(), helperStatefulShutdown(), StatefulEnqueue(), and StatefulGetFirstAvailable().
◆ cmdline
◆ droppedRequests
◆ eom
◆ id_name
|
inherited |
Definition at line 118 of file helper.h.
Referenced by Enqueue(), helperReturnBuffer(), helperShutdown(), helperStatefulShutdown(), and StatefulEnqueue().
◆ ipc_type
◆ last_queue_warn
|
inherited |
Definition at line 124 of file helper.h.
Referenced by Enqueue(), and StatefulEnqueue().
◆ last_restart
◆ onTimedOutResponse
◆ overloadStart
◆ queue
|
inherited |
Definition at line 117 of file helper.h.
Referenced by Enqueue(), and StatefulEnqueue().
◆ reservations
|
private |
◆ retryBrokenHelper
◆ retryTimedOut
|
inherited |
Definition at line 127 of file helper.h.
Referenced by helperReturnBuffer().
◆ servers
|
inherited |
Definition at line 116 of file helper.h.
Referenced by GetFirstAvailable(), helperShutdown(), helperStatefulShutdown(), and StatefulGetFirstAvailable().
◆ stats
|
inherited |
Referenced by Enqueue(), helperReturnBuffer(), and StatefulEnqueue().
◆ timeout
|
inherited |
Definition at line 126 of file helper.h.
Referenced by helperReturnBuffer().
The documentation for this class was generated from the following files:
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products