#include <Forwarder.h>


Public Types | |
typedef CbcPointer< AsyncJob > | Pointer |
Public Member Functions | |
Forwarder (Request::Pointer aRequest, double aTimeout) | |
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... | |
Public Attributes | |
CodeContextPointer | codeContext |
Protected Types | |
typedef std::map< unsigned int, AsyncCall::Pointer > | RequestsMap |
maps request->id to Forwarder::handleRemoteAck callback More... | |
Protected Member Functions | |
virtual void | start () |
called by AsyncStart; do not call directly More... | |
virtual void | swanSong () |
virtual bool | doneAll () const |
whether positive goal has been reached More... | |
virtual void | handleError () |
virtual void | handleTimeout () |
virtual void | handleException (const std::exception &e) |
terminate with an error 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< AsyncJob > | id |
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 | 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... | |
Detailed Description
Forwards a worker request to coordinator. Waits for an ACK from Coordinator Send the data unit with an error response if forwarding fails.
Definition at line 29 of file Forwarder.h.
Member Typedef Documentation
◆ Pointer
|
inherited |
Definition at line 34 of file AsyncJob.h.
◆ RequestsMap
|
protected |
Definition at line 69 of file Forwarder.h.
Constructor & Destructor Documentation
◆ Forwarder()
Ipc::Forwarder::Forwarder | ( | Request::Pointer | aRequest, |
double | aTimeout | ||
) |
Definition at line 26 of file Forwarder.cc.
◆ ~Forwarder()
|
virtual |
Reimplemented in Mgr::Forwarder.
Definition at line 33 of file Forwarder.cc.
References Must, request(), and SWALLOW_EXCEPTIONS.
Member Function Documentation
◆ callEnd()
|
virtualinherited |
called right after the called job method
Reimplemented in Adaptation::Icap::Xaction.
Definition at line 136 of file AsyncJob.cc.
References AsyncCall::debugLevel, debugs, AsyncCall::debugSection, AsyncJob::done(), HERE(), AsyncJob::inCall, NULL, AsyncJob::status(), AsyncJob::swanSong(), and AsyncJob::typeName.
Referenced by Adaptation::Icap::Xaction::callEnd(), and AsyncJob::deleteThis().
◆ callException()
|
virtual |
Reimplemented from AsyncJob.
Definition at line 140 of file Forwarder.cc.
References AsyncJob::callException(), DBG_CRITICAL, debugs, and HERE().
◆ callStart()
|
inherited |
called just before the called method
Definition at line 114 of file AsyncJob.cc.
References cbdataReferenceValid(), AsyncCall::debugLevel, debugs, AsyncCall::debugSection, AsyncJob::inCall, Must, AsyncJob::status(), CbdataParent::toCbdata(), and AsyncJob::typeName.
◆ canBeCalled()
|
inherited |
Definition at line 101 of file AsyncJob.cc.
References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.
◆ CBDATA_CLASS()
|
private |
◆ deleteThis()
|
protectedinherited |
Definition at line 49 of file AsyncJob.cc.
References asyncCall(), AsyncJob::callEnd(), debugs, AsyncJob::inCall, JobMemFun(), Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by ConnStateData::connStateClosed().
◆ DequeueRequest()
|
staticprivate |
◆ done()
|
protectedinherited |
Definition at line 90 of file AsyncJob.cc.
References AsyncJob::doneAll(), NULL, and AsyncJob::stopReason.
Referenced by AsyncJob::callEnd(), HappyConnOpener::checkForNewConnection(), and Downloader::downloadFinished().
◆ doneAll()
|
protectedvirtual |
◆ handleError()
|
protectedvirtual |
Reimplemented in Mgr::Forwarder.
Definition at line 120 of file Forwarder.cc.
◆ handleException()
|
protectedvirtual |
Reimplemented in Snmp::Forwarder, and Mgr::Forwarder.
Definition at line 133 of file Forwarder.cc.
References debugs, and HERE().
Referenced by Mgr::Forwarder::handleException(), and Snmp::Forwarder::handleException().
◆ handleRemoteAck()
|
private |
◆ HandleRemoteAck()
|
static |
Definition at line 175 of file Forwarder.cc.
References debugs, HERE(), Must, NULL, and ScheduleCallHere.
Referenced by Ipc::Strand::handleCacheMgrResponse(), and Ipc::Strand::handleSnmpResponse().
◆ handleTimeout()
|
protectedvirtual |
Reimplemented in Snmp::Forwarder, and Mgr::Forwarder.
Definition at line 126 of file Forwarder.cc.
Referenced by Mgr::Forwarder::handleTimeout(), and Snmp::Forwarder::handleTimeout().
◆ mustStop()
|
protectedinherited |
Definition at line 69 of file AsyncJob.cc.
References debugs, AsyncJob::inCall, Must, NULL, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by HttpStateData::abortAll(), AsyncJob::callException(), HttpStateData::continueAfterParsingHeader(), HttpStateData::drop1xx(), HttpStateData::handleMoreRequestBodyAvailable(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), Comm::ConnOpener::noteAbort(), HttpStateData::proceedAfter1xx(), ConnStateData::proxyProtocolError(), HttpStateData::readReply(), HttpStateData::start(), and HttpStateData::wroteLast().
◆ removeTimeoutEvent()
|
private |
Definition at line 168 of file Forwarder.cc.
References eventDelete(), eventFind(), and RequestTimedOut().
◆ requestTimedOut()
|
private |
Definition at line 113 of file Forwarder.cc.
◆ RequestTimedOut()
|
staticprivate |
Definition at line 99 of file Forwarder.cc.
References CallBack(), codeContext, debugs, HERE(), Must, and NULL.
Referenced by removeTimeoutEvent(), and start().
◆ start()
|
protectedvirtual |
Reimplemented from AsyncJob.
Definition at line 41 of file Forwarder.cc.
References callback, Ipc::Port::CoordinatorAddr(), debugs, eventAdd(), handleRemoteAck(), HERE(), JobCallback, request(), RequestTimedOut(), and Ipc::SendMessage().
◆ Start()
|
staticinherited |
Definition at line 23 of file AsyncJob.cc.
References CallJobHere, and AsyncJob::start().
Referenced by Ftp::Server::AcceptCtrlConnection(), Ftp::Server::checkDataConnPre(), clientListenerConnectionOpened(), Ftp::Client::connectDataChannel(), FwdState::connectStart(), Adaptation::Icap::Xaction::dnsLookupDone(), Log::TcpLogger::doConnect(), FwdState::establishTunnelThruProxy(), TunnelStateData::establishTunnelThruProxy(), Ipc::Coordinator::handleCacheMgrRequest(), PeerPoolMgr::handleOpenedConnection(), Ipc::Coordinator::handleSnmpRequest(), httpAccept(), httpsAccept(), httpStart(), idnsInitVC(), Ftp::Gateway::listenForDataChannel(), Ftp::Server::listenForDataConnection(), Adaptation::Icap::Xaction::noteCommConnected(), Log::TcpLogger::Open(), HappyConnOpener::openFreshConnection(), PeerPoolMgr::openNewConnection(), peerProbeConnect(), Mgr::FunAction::respond(), Mgr::InfoAction::respond(), FwdState::secureConnectionToPeer(), TunnelStateData::secureConnectionToPeer(), Ipc::SendMessage(), Mgr::Inquirer::sendResponse(), snmpConstructReponse(), SquidMain(), CacheManager::start(), Ident::Start(), Adaptation::AccessCheck::Start(), Rock::Rebuild::Start(), Security::PeerConnector::startCertDownloading(), TunnelStateData::startConnecting(), Ftp::StartGateway(), Ftp::StartRelay(), PeerPoolMgrsRr::syncConfig(), and Rock::SwapDir::updateHeaders().
◆ status()
|
protectedvirtualinherited |
for debugging, starts with space
Reimplemented in HappyConnOpener, Security::PeerConnector, Ipc::Inquirer, Comm::TcpAcceptor, Http::Tunneler, Adaptation::Initiate, Adaptation::Icap::Xaction, Adaptation::Icap::ServiceRep, and Adaptation::Ecap::XactionRep.
Definition at line 159 of file AsyncJob.cc.
References buf, NULL, and AsyncJob::stopReason.
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), Adaptation::Initiate::status(), and Comm::TcpAcceptor::status().
◆ swanSong()
|
protectedvirtual |
Reimplemented from AsyncJob.
Reimplemented in Snmp::Forwarder, and Mgr::Forwarder.
Definition at line 68 of file Forwarder.cc.
References debugs, HERE(), and request().
Referenced by Mgr::Forwarder::swanSong(), and Snmp::Forwarder::swanSong().
◆ toCbdata()
|
pure virtualinherited |
Implemented in HttpStateData, ClientHttpRequest, and BodySink.
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
Member Data Documentation
◆ codeContext
CodeContextPointer Ipc::Forwarder::codeContext |
Definition at line 43 of file Forwarder.h.
Referenced by RequestTimedOut().
◆ id
|
protectedinherited |
Definition at line 72 of file AsyncJob.h.
◆ inCall
|
protectedinherited |
Definition at line 71 of file AsyncJob.h.
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::canBeCalled(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
◆ LastRequestId
|
staticprotected |
Definition at line 72 of file Forwarder.h.
◆ request
|
protected |
Definition at line 65 of file Forwarder.h.
◆ stopReason
|
protectedinherited |
Definition at line 69 of file AsyncJob.h.
Referenced by AsyncJob::deleteThis(), AsyncJob::done(), AsyncJob::mustStop(), AsyncJob::status(), and HappyConnOpener::status().
◆ TheRequestsMap
|
staticprotected |
Definition at line 70 of file Forwarder.h.
◆ timeout
|
protected |
Definition at line 66 of file Forwarder.h.
◆ typeName
|
protectedinherited |
Definition at line 70 of file AsyncJob.h.
Referenced by AsyncJob::AsyncJob(), Adaptation::Icap::Xaction::Xaction(), AsyncJob::~AsyncJob(), AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
The documentation for this class was generated from the following files:
- src/ipc/Forwarder.h
- src/ipc/Forwarder.cc