#include <helper.h>

Inheritance diagram for statefulhelper:
Collaboration diagram for statefulhelper:

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)
 
virtual ~statefulhelper ()=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...
 
Helper::XactionnextRequest ()
 
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=NULL) const
 Dump some stats about the helper state to a Packable object. More...
 
bool willOverload () const
 
void handleKilledServer (HelperServerBase *srv, bool &needsNewServers)
 

Public Attributes

wordlistcmdline = nullptr
 
dlink_list servers
 
std::queue< Helper::Xaction * > queue
 
const char * id_name = nullptr
 
Helper::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 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_serverfindServer (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)
 If possible, submit request. Otherwise, either kill Squid or return false. More...
 

Private Attributes

Reservations reservations
 reserved servers indexed by reservation IDs More...
 

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

Definition at line 129 of file helper.h.

Member Typedef Documentation

◆ Reservations

Definition at line 131 of file helper.h.

Constructor & Destructor Documentation

◆ statefulhelper()

statefulhelper::statefulhelper ( const char *  name)
inlineexplicit

Definition at line 136 of file helper.h.

◆ ~statefulhelper()

virtual statefulhelper::~statefulhelper ( )
virtualdefault

Member Function Documentation

◆ cancelReservation()

◆ findServer()

helper_stateful_server * statefulhelper::findServer ( const Helper::ReservationId reservation)
private
Returns
the previously reserved server (if the reservation is still valid) or nil

Definition at line 599 of file helper.cc.

References reservations.

Referenced by submit().

◆ handleKilledServer()

void helper::handleKilledServer ( HelperServerBase srv,
bool &  needsNewServers 
)
inherited

◆ nextRequest()

Helper::Xaction * helper::nextRequest ( )
inherited
Returns
next request in the queue, or nil.

Definition at line 1247 of file helper.cc.

References helper::queue, helper::_stats::queue_size, and helper::stats.

Referenced by helperKickQueue(), and helperStatefulKickQueue().

◆ operator delete()

void statefulhelper::operator delete ( void *  address)
inline

Definition at line 131 of file helper.h.

◆ operator new()

void* statefulhelper::operator new ( size_t  size)
inline

Definition at line 131 of file helper.h.

◆ overloaded()

bool helper::overloaded ( ) const
protectedinherited

◆ packStatsInto()

◆ prepSubmit()

bool helper::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 504 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()

bool helper::queueFull ( ) const
protectedinherited

◆ reserveServer()

◆ submit() [1/2]

void helper::submit ( const char *  buf,
HLPCB callback,
void *  data 
)
protectedinherited

Definition at line 542 of file helper.cc.

References buf, callback, data, DBG_DATA, debugs, and helper::submitRequest().

Referenced by helper::trySubmit().

◆ submit() [2/2]

◆ submitRequest()

void helper::submitRequest ( Helper::Xaction r)
inherited

Submits a request to the helper or add it to the queue if none of the servers is available.

Definition at line 431 of file helper.cc.

References Enqueue(), GetFirstAvailable(), helperDispatch(), and helper::syncQueueStats().

Referenced by helper_server::checkForTimedOutRequests(), helperReturnBuffer(), and helper::submit().

◆ syncQueueStats()

void helper::syncQueueStats ( )
protectedinherited

◆ toCbdata()

void* statefulhelper::toCbdata ( )
inlinenoexcept

Definition at line 131 of file helper.h.

◆ trySubmit() [1/2]

bool helper::trySubmit ( const char *  buf,
HLPCB callback,
void *  data 
)
inherited

Definition at line 531 of file helper.cc.

References buf, callback, data, helper::prepSubmit(), and helper::submit().

Referenced by helperSubmit(), and ExternalACLLookup::Start().

◆ trySubmit() [2/2]

bool statefulhelper::trySubmit ( const char *  buf,
HLPCB callback,
void *  data,
const Helper::ReservationId reservation 
)
private

Definition at line 560 of file helper.cc.

References buf, callback, data, helper::prepSubmit(), and submit().

Referenced by helperStatefulSubmit().

◆ willOverload()

bool helper::willOverload ( ) const
inherited

whether the helper will be in "overloaded" state after one more request already overloaded helpers return true

Definition at line 720 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

void helperStatefulSubmit ( statefulhelper hlp,
const char *  buf,
HLPCB callback,
void *  data,
const Helper::ReservationId reservation 
)
friend

Submit request or callback the caller with a Helper::Error error. If the reservation is not set then reserves a new helper.

Definition at line 552 of file helper.cc.

Member Data Documentation

◆ addr

Ip::Address helper::addr
inherited

Definition at line 101 of file helper.h.

Referenced by helperOpenServers(), and helperStatefulOpenServers().

◆ CBDATA_helper

cbdata_type helper::CBDATA_helper = CBDATA_UNKNOWN
staticprivateinherited

Definition at line 67 of file helper.h.

◆ CBDATA_statefulhelper

cbdata_type statefulhelper::CBDATA_statefulhelper = CBDATA_UNKNOWN
staticprivate

Definition at line 131 of file helper.h.

◆ childs

◆ cmdline

wordlist* helper::cmdline = nullptr
inherited

◆ droppedRequests

unsigned int helper::droppedRequests = 0
inherited

Definition at line 102 of file helper.h.

Referenced by helper::prepSubmit(), and helper::syncQueueStats().

◆ eom

char helper::eom = '\n'
inherited

Definition at line 110 of file helper.h.

Referenced by helperHandleRead(), helperStatefulHandleRead(), and Ssl::Helper::Init().

◆ id_name

◆ ipc_type

int helper::ipc_type = 0
inherited

◆ last_queue_warn

time_t helper::last_queue_warn = 0
inherited

Definition at line 104 of file helper.h.

Referenced by Enqueue(), and StatefulEnqueue().

◆ last_restart

time_t helper::last_restart = 0
inherited

◆ onTimedOutResponse

SBuf helper::onTimedOutResponse
inherited

Definition at line 109 of file helper.h.

Referenced by helper_server::checkForTimedOutRequests(), and redirectInit().

◆ overloadStart

time_t helper::overloadStart = 0
inherited

Definition at line 103 of file helper.h.

Referenced by helper::prepSubmit(), and helper::syncQueueStats().

◆ queue

std::queue<Helper::Xaction *> helper::queue
inherited

Definition at line 97 of file helper.h.

Referenced by Enqueue(), helper::nextRequest(), StatefulEnqueue(), and helper::~helper().

◆ reservations

Reservations statefulhelper::reservations
private

Definition at line 156 of file helper.h.

Referenced by cancelReservation(), findServer(), and reserveServer().

◆ retryBrokenHelper

bool helper::retryBrokenHelper = false
inherited

Definition at line 108 of file helper.h.

Referenced by redirectInit().

◆ retryTimedOut

bool helper::retryTimedOut = false
inherited

Definition at line 107 of file helper.h.

Referenced by helperReturnBuffer(), redirectInit(), and helper_server::requestTimeout().

◆ servers

◆ stats

◆ timeout

time_t helper::timeout = 0
inherited

The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors