helper.cc 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 helper.cc:

Go to the source code of this file.

Macros

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

Functions

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 *)
 

Variables

static IOCB helperHandleRead
 
static IOCB helperStatefulHandleRead
 

Macro Definition Documentation

◆ HELPER_MAX_ARGS

#define HELPER_MAX_ARGS   64

Definition at line 36 of file helper.cc.

◆ MAX_RETRIES

#define MAX_RETRIES   2

Definition at line 39 of file helper.cc.

Function Documentation

◆ Enqueue()

◆ GetFirstAvailable()

◆ helperDispatch()

◆ helperDispatchWriteDone()

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

◆ helperHandleRead()

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

◆ helperKickQueue()

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

◆ helperReturnBuffer()

◆ helperShutdown()

◆ helperStatefulDispatch()

◆ helperStatefulDispatchWriteDone()

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

Definition at line 1465 of file helper.cc.

Referenced by helperStatefulDispatch().

◆ helperStatefulHandleRead()

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

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 helper.cc.

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 helper.cc.

◆ helperSubmit()

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

Definition at line 480 of file helper.cc.

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

Referenced by constructHelperQuery().

◆ InstanceIdDefinitions()

InstanceIdDefinitions ( Helper::SessionBase  ,
"Hlpr"   
)

◆ ReadBufSize()

const size_t ReadBufSize ( 32 *  1024)

◆ StatefulEnqueue()

◆ StatefulGetFirstAvailable()

◆ SubmissionFailure()

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

Definition at line 467 of file helper.cc.

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

Referenced by helperSubmit().

Variable Documentation

◆ helperHandleRead

IOCB helperHandleRead
static

Definition at line 44 of file helper.cc.

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

◆ helperStatefulHandleRead

IOCB helperStatefulHandleRead
static

Definition at line 45 of file helper.cc.

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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors