File Reference
#include "squid.h"
#include "base/AsyncCbdataCalls.h"
#include "base/Packable.h"
#include "base/Raw.h"
#include "comm.h"
#include "comm/Connection.h"
#include "comm/Read.h"
#include "comm/Write.h"
#include "debug/Messages.h"
#include "fd.h"
#include "fde.h"
#include "format/Quoting.h"
#include "helper.h"
#include "helper/Reply.h"
#include "helper/Request.h"
#include "MemBuf.h"
#include "SquidConfig.h"
#include "SquidIpc.h"
#include "SquidMath.h"
#include "Store.h"
#include "wordlist.h"
#include "mem/Pool.h"
Include dependency graph for

Go to the source code of this file.


#define HELPER_MAX_ARGS   64
#define MAX_RETRIES   2
 The maximum allowed request retries. More...


const size_t ReadBufSize (32 *1024)
 Helpers input buffer size. More...
static void Enqueue (Helper::Client *const hlp, Helper::Xaction *const r)
 Handles a request when all running helpers, if any, are busy. More...
static Helper::SessionGetFirstAvailable (const Helper::Client::Pointer &)
static helper_stateful_serverStatefulGetFirstAvailable (const statefulhelper::Pointer &)
static void helperDispatch (Helper::Session *, Helper::Xaction *)
static void helperStatefulDispatch (helper_stateful_server *srv, Helper::Xaction *r)
static void helperKickQueue (const Helper::Client::Pointer &)
static void helperStatefulKickQueue (const statefulhelper::Pointer &)
static void helperStatefulServerDone (helper_stateful_server *srv)
static void StatefulEnqueue (statefulhelper *hlp, Helper::Xaction *r)
 InstanceIdDefinitions (Helper::SessionBase, "Hlpr")
static void SubmissionFailure (const Helper::Client::Pointer &hlp, HLPCB *callback, void *data)
 handles helperSubmit() and helperStatefulSubmit() failures More...
void helperSubmit (const Helper::Client::Pointer &hlp, const char *const buf, HLPCB *const callback, void *const data)
void helperStatefulSubmit (const statefulhelper::Pointer &hlp, const char *buf, HLPCB *callback, void *data, const Helper::ReservationId &reservation)
void helperShutdown (const Helper::Client::Pointer &hlp)
void helperStatefulShutdown (const statefulhelper::Pointer &hlp)
static void helperReturnBuffer (Helper::Session *srv, const Helper::Client::Pointer &hlp, char *const msg, const size_t msgSize, const char *const msgEnd)
 Calls back with a pointer to the buffer with the helper output. More...
static void helperHandleRead (const Comm::ConnectionPointer &conn, char *, size_t len, Comm::Flag flag, int, void *data)
static void helperStatefulHandleRead (const Comm::ConnectionPointer &conn, char *, size_t len, Comm::Flag flag, int, void *data)
static void helperDispatchWriteDone (const Comm::ConnectionPointer &, char *, size_t, Comm::Flag flag, int, void *data)
static void helperStatefulDispatchWriteDone (const Comm::ConnectionPointer &, char *, size_t, Comm::Flag, int, void *)


static IOCB helperHandleRead
static IOCB helperStatefulHandleRead

Macro Definition Documentation


#define HELPER_MAX_ARGS   64

Definition at line 36 of file


#define MAX_RETRIES   2

Definition at line 39 of file

Function Documentation

◆ Enqueue()

◆ GetFirstAvailable()

◆ helperDispatch()

◆ helperDispatchWriteDone()

static void helperDispatchWriteDone ( const Comm::ConnectionPointer ,
char *  ,
size_t  ,
Comm::Flag  flag,
int  ,
void *  data 

◆ helperHandleRead()

static void helperHandleRead ( const Comm::ConnectionPointer conn,
char *  ,
size_t  len,
Comm::Flag  flag,
int  ,
void *  data 

◆ helperKickQueue()

static void helperKickQueue ( const Helper::Client::Pointer hlp)

◆ helperReturnBuffer()

◆ helperShutdown()

◆ helperStatefulDispatch()

◆ helperStatefulDispatchWriteDone()

static void helperStatefulDispatchWriteDone ( const Comm::ConnectionPointer ,
char *  ,
size_t  ,
Comm::Flag  ,
int  ,
void *   

Definition at line 1465 of file

Referenced by helperStatefulDispatch().

◆ helperStatefulHandleRead()

static void helperStatefulHandleRead ( const Comm::ConnectionPointer conn,
char *  ,
size_t  len,
Comm::Flag  flag,
int  ,
void *  data 

BUG: the below assumes that only one response per read() was received and discards any octets remaining. Doing this prohibits concurrency support with multiple replies per read(). TODO: check that read() setup on these buffers pays attention to roffest!=0 TODO: check that replies bigger than the buffer are discarded and do not to affect future replies

Definition at line 1129 of file

References Helper::SessionBase::answer_time, assert, cbdataReferenceValid(), Helper::SessionBase::closePipesSafely(), comm_read(), commCbCall(), conn, current_time, DBG_DATA, DBG_IMPORTANT, debugs, Helper::SessionBase::dispatch_time, Comm::ERR_CLOSING, Comm::Connection::fd, fd_table, helperStatefulHandleRead, helperStatefulServerDone(), Helper::SessionBase::index, Math::intAverage(), Comm::IsConnOpen(), Comm::OK, helper_stateful_server::parent, Helper::SessionBase::pending, Helper::SessionBase::rbuf, Helper::SessionBase::rbuf_sz, Helper::SessionBase::readPipe, REDIRECT_AV_FACTOR, Helper::SessionBase::replies, Helper::SessionBase::requests, helper_stateful_server::reservationId, Helper::SessionBase::roffset, Helper::SessionBase::stats, and tvSubMsec().

◆ helperStatefulKickQueue()

◆ helperStatefulServerDone()

◆ helperStatefulShutdown()

◆ helperStatefulSubmit()

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

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 586 of file

◆ helperSubmit()

void helperSubmit ( const Helper::Client::Pointer hlp,
const char *const  buf,
HLPCB *const  callback,
void *const  data 

Definition at line 480 of file

References SubmissionFailure(), and Helper::Client::trySubmit().

Referenced by constructHelperQuery().

◆ InstanceIdDefinitions()

InstanceIdDefinitions ( Helper::SessionBase  ,

◆ ReadBufSize()

const size_t ReadBufSize ( 32 *  1024)

◆ StatefulEnqueue()

◆ StatefulGetFirstAvailable()

◆ SubmissionFailure()

static void SubmissionFailure ( const Helper::Client::Pointer hlp,
HLPCB callback,
void *  data 

Definition at line 467 of file

References debugs, Helper::Error, and Helper::Unknown.

Referenced by helperSubmit().

Variable Documentation

◆ helperHandleRead

IOCB helperHandleRead

Definition at line 44 of file

Referenced by helperHandleRead(), and Helper::Client::openSessions().

◆ helperStatefulHandleRead

IOCB helperStatefulHandleRead

Definition at line 45 of file

Referenced by helperStatefulHandleRead(), and statefulhelper::openSessions().






Web Site Translations