#include <Forwarder.h>

Inheritance diagram for Mgr::Forwarder:
Collaboration diagram for Mgr::Forwarder:

Public Types

typedef CbcPointer< AsyncJobPointer
 

Public Member Functions

 Forwarder (const Comm::ConnectionPointer &aConn, const ActionParams &aParams, HttpRequest *aRequest, StoreEntry *anEntry, const AccessLogEntryPointer &anAle)
 
virtual ~Forwarder ()
 
virtual void callException (const std::exception &e)
 called when the job throws during an async call More...
 
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
 
void callStart (AsyncCall &call)
 
virtual void callEnd ()
 called right after the called job method More...
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static void HandleRemoteAck (unsigned int requestId)
 finds and calls the right Forwarder upon Coordinator's response More...
 
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...
 

Protected Types

typedef std::map< unsigned int, AsyncCall::PointerRequestsMap
 maps request->id to Forwarder::handleRemoteAck callback More...
 

Protected Member Functions

virtual void swanSong ()
 closes our copy of the client HTTP connection socket More...
 
virtual void handleError ()
 
virtual void handleTimeout ()
 
virtual void handleException (const std::exception &e)
 terminate with an error More...
 
virtual void start ()
 called by AsyncStart; do not call directly More...
 
virtual bool doneAll () const
 whether positive goal has been reached More...
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done() More...
 
virtual const char * status () const
 internal cleanup; do not call directly More...
 

Protected Attributes

Request::Pointer request
 
const double timeout
 response wait timeout in seconds More...
 
const char * stopReason
 reason for forcing done() to be true More...
 
const char * typeName
 kid (leaf) class name, for debugging More...
 
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any More...
 
const InstanceId< AsyncJobid
 job identifier More...
 

Static Protected Attributes

static RequestsMap TheRequestsMap
 pending Coordinator requests More...
 
static unsigned int LastRequestId = 0
 last requestId used More...
 

Private Member Functions

 CBDATA_CLASS (Forwarder)
 
void noteCommClosed (const CommCloseCbParams &params)
 called when the client socket gets closed by some external force More...
 
void sendError (ErrorState *error)
 send error page More...
 
void requestTimedOut ()
 called when Coordinator fails to start processing the request [in time] More...
 
void removeTimeoutEvent ()
 called when we are no longer waiting for Coordinator to respond More...
 
void handleRemoteAck ()
 called when Coordinator starts processing the request More...
 

Static Private Member Functions

static void RequestTimedOut (void *param)
 Ipc::Forwarder::requestTimedOut wrapper. More...
 
static AsyncCall::Pointer DequeueRequest (unsigned int requestId)
 returns and forgets the right Forwarder callback for the request More...
 

Private Attributes

HttpRequesthttpRequest
 HTTP client request for detailing errors. More...
 
StoreEntryentry
 Store entry expecting the response. More...
 
Comm::ConnectionPointer conn
 HTTP client connection descriptor. More...
 
AsyncCall::Pointer closer
 comm_close handler for the HTTP connection More...
 
AccessLogEntryPointer ale
 more transaction details More...
 

Detailed Description

Forwards a single client cache manager request to Coordinator. Waits for an ACK from Coordinator while holding the Store entry. Fills the store entry with an error response if forwarding fails.

Definition at line 31 of file Forwarder.h.

Member Typedef Documentation

◆ Pointer

Definition at line 34 of file AsyncJob.h.

◆ RequestsMap

typedef std::map<unsigned int, AsyncCall::Pointer> Ipc::Forwarder::RequestsMap
protectedinherited

Definition at line 66 of file Forwarder.h.

Constructor & Destructor Documentation

◆ Forwarder()

Mgr::Forwarder::Forwarder ( const Comm::ConnectionPointer aConn,
const ActionParams aParams,
HttpRequest aRequest,
StoreEntry anEntry,
const AccessLogEntryPointer anAle 
)

◆ ~Forwarder()

Mgr::Forwarder::~Forwarder ( )
virtual

Reimplemented from Ipc::Forwarder.

Definition at line 47 of file Forwarder.cc.

References HTTPMSGUNLOCK(), Must, and SWALLOW_EXCEPTIONS.

Member Function Documentation

◆ callEnd()

void AsyncJob::callEnd ( )
virtualinherited

◆ callException()

void Ipc::Forwarder::callException ( const std::exception &  e)
virtualinherited

Reimplemented from AsyncJob.

Definition at line 136 of file Forwarder.cc.

References AsyncJob::callException(), DBG_CRITICAL, debugs, and HERE().

◆ callStart()

void AsyncJob::callStart ( AsyncCall call)
inherited

◆ canBeCalled()

bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 101 of file AsyncJob.cc.

References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.

◆ CBDATA_CLASS()

Mgr::Forwarder::CBDATA_CLASS ( Forwarder  )
private

◆ deleteThis()

void AsyncJob::deleteThis ( const char *  aReason)
protectedinherited

◆ DequeueRequest()

AsyncCall::Pointer Ipc::Forwarder::DequeueRequest ( unsigned int  requestId)
staticprivateinherited

Definition at line 148 of file Forwarder.cc.

References debugs, HERE(), Must, NULL, and request().

◆ done()

bool AsyncJob::done ( ) const
protectedinherited

◆ doneAll()

bool Ipc::Forwarder::doneAll ( ) const
protectedvirtualinherited

Reimplemented from AsyncJob.

Definition at line 78 of file Forwarder.cc.

References debugs, HERE(), and request().

◆ handleError()

void Mgr::Forwarder::handleError ( )
protectedvirtual

Reimplemented from Ipc::Forwarder.

Definition at line 73 of file Forwarder.cc.

References DBG_CRITICAL, debugs, ERR_INVALID_URL, and Http::scUriTooLong.

◆ handleException()

void Mgr::Forwarder::handleException ( const std::exception &  e)
protectedvirtual

◆ handleRemoteAck()

void Ipc::Forwarder::handleRemoteAck ( )
privateinherited

Definition at line 86 of file Forwarder.cc.

References debugs, HERE(), and request().

Referenced by Ipc::Forwarder::start().

◆ HandleRemoteAck()

void Ipc::Forwarder::HandleRemoteAck ( unsigned int  requestId)
staticinherited

◆ handleTimeout()

void Mgr::Forwarder::handleTimeout ( )
protectedvirtual

Reimplemented from Ipc::Forwarder.

Definition at line 81 of file Forwarder.cc.

References ERR_LIFETIME_EXP, Ipc::Forwarder::handleTimeout(), and Http::scRequestTimeout.

◆ mustStop()

◆ noteCommClosed()

void Mgr::Forwarder::noteCommClosed ( const CommCloseCbParams params)
private

Definition at line 97 of file Forwarder.cc.

References conn, debugs, HERE(), and NULL.

Referenced by Forwarder().

◆ removeTimeoutEvent()

void Ipc::Forwarder::removeTimeoutEvent ( )
privateinherited

Definition at line 164 of file Forwarder.cc.

References eventDelete(), eventFind(), and Ipc::Forwarder::RequestTimedOut().

◆ requestTimedOut()

void Ipc::Forwarder::requestTimedOut ( )
privateinherited

Definition at line 109 of file Forwarder.cc.

References debugs, and HERE().

◆ RequestTimedOut()

void Ipc::Forwarder::RequestTimedOut ( void *  param)
staticprivateinherited

Definition at line 98 of file Forwarder.cc.

References CallJobHere, debugs, HERE(), Must, and NULL.

Referenced by Ipc::Forwarder::removeTimeoutEvent(), and Ipc::Forwarder::start().

◆ sendError()

void Mgr::Forwarder::sendError ( ErrorState error)
private

Definition at line 106 of file Forwarder.cc.

References debugs, error(), HERE(), Must, NULL, and squid_curtime.

◆ start()

void Ipc::Forwarder::start ( )
protectedvirtualinherited

◆ Start()

◆ status()

const char * AsyncJob::status ( ) const
protectedvirtualinherited

◆ swanSong()

void Mgr::Forwarder::swanSong ( )
protectedvirtual

Reimplemented from Ipc::Forwarder.

Definition at line 59 of file Forwarder.cc.

References comm_remove_close_handler(), conn, Comm::IsConnOpen(), NULL, and Ipc::Forwarder::swanSong().

◆ toCbdata()

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

◆ ale

AccessLogEntryPointer Mgr::Forwarder::ale
private

Definition at line 56 of file Forwarder.h.

◆ closer

AsyncCall::Pointer Mgr::Forwarder::closer
private

Definition at line 55 of file Forwarder.h.

Referenced by Forwarder().

◆ conn

Comm::ConnectionPointer Mgr::Forwarder::conn
private

Definition at line 54 of file Forwarder.h.

Referenced by Forwarder().

◆ entry

StoreEntry* Mgr::Forwarder::entry
private

Definition at line 53 of file Forwarder.h.

Referenced by Forwarder().

◆ httpRequest

HttpRequest* Mgr::Forwarder::httpRequest
private

Definition at line 52 of file Forwarder.h.

Referenced by Forwarder().

◆ id

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 72 of file AsyncJob.h.

◆ inCall

AsyncCall::Pointer AsyncJob::inCall
protectedinherited

◆ LastRequestId

unsigned int Ipc::Forwarder::LastRequestId = 0
staticprotectedinherited

Definition at line 69 of file Forwarder.h.

◆ request

Request::Pointer Ipc::Forwarder::request
protectedinherited

Definition at line 62 of file Forwarder.h.

◆ stopReason

const char* AsyncJob::stopReason
protectedinherited

◆ TheRequestsMap

Ipc::Forwarder::RequestsMap Ipc::Forwarder::TheRequestsMap
staticprotectedinherited

Definition at line 67 of file Forwarder.h.

◆ timeout

const double Ipc::Forwarder::timeout
protectedinherited

Definition at line 63 of file Forwarder.h.

◆ typeName


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors