Receives coordination messages on behalf of its process or thread. More...
#include <Strand.h>
Public Types | |
typedef CbcPointer< AsyncJob > | Pointer |
Public Member Functions | |
Strand () | |
void | start () override |
called by AsyncStart; do not call directly 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 | callException (const std::exception &e) |
called when the job throws during an async call More... | |
void | handleStopRequest () |
process external request to terminate now (i.e. during this async call) More... | |
virtual void * | toCbdata ()=0 |
Static Public Member Functions | |
static String | MakeAddr (const char *proccessLabel, int id) |
calculates IPC message address for strand id of processLabel type More... | |
static String | CoordinatorAddr () |
get the IPC message address for coordinator process More... | |
static void | Start (const Pointer &job) |
static void | RegisterWithCacheManager () |
Public Attributes | |
struct sockaddr_un | address |
UDS address from path; treat as read-only. More... | |
const InstanceId< AsyncJob > | id |
job identifier More... | |
Protected Member Functions | |
void | timedout () override |
called after setTimeout() if timed out More... | |
void | receive (const TypedMsgHdr &message) override |
bool | doneAll () const override |
whether positive goal has been reached More... | |
void | doListen () |
read the next incoming message More... | |
Comm::ConnectionPointer & | conn () |
creates if needed and returns raw UDS socket descriptor More... | |
void | setTimeout (time_t seconds, const char *handlerName) |
call timedout() if no UDS messages in a given number of seconds More... | |
void | clearTimeout () |
remove previously set timeout, if any More... | |
void | setOptions (int newOptions) |
changes socket options More... | |
void | deleteThis (const char *aReason) |
void | mustStop (const char *aReason) |
bool | done () const |
the job is destroyed in callEnd() when done() More... | |
virtual void | swanSong () |
virtual const char * | status () const |
internal cleanup; do not call directly More... | |
Static Protected Member Functions | |
static void | ReportAllJobs (StoreEntry *) |
writes a cache manager report about all jobs existing in this worker More... | |
Protected Attributes | |
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... | |
bool | started_ = false |
Start() has finished successfully. More... | |
bool | swanSang_ = false |
swanSong() was called More... | |
Private Member Functions | |
CBDATA_CHILD (Strand) | |
void | registerSelf () |
void | handleRegistrationResponse (const StrandMessage &) |
let Coordinator know this strand exists More... | |
void | handleCacheMgrRequest (const Mgr::Request &request) |
void | handleCacheMgrResponse (const Mgr::Response &response) |
void | handleSnmpRequest (const Snmp::Request &request) |
void | handleSnmpResponse (const Snmp::Response &response) |
Strand (const Strand &) | |
Strand & | operator= (const Strand &) |
void | noteRead (const CommIoCbParams ¶ms) |
void | receiveOrIgnore (const TypedMsgHdr &) |
receive() but ignore any errors More... | |
void | noteTimeout (const CommTimeoutCbParams &p) |
Comm timeout callback; calls timedout() More... | |
virtual void | finalizedInCbdataChild ()=0 |
hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More... | |
Private Attributes | |
bool | isRegistered |
whether Coordinator ACKed registration (unused) More... | |
TypedMsgHdr | buf |
msghdr struct filled by Comm More... | |
int | options |
UDS options. More... | |
Comm::ConnectionPointer | conn_ |
UDS descriptor. More... | |
Detailed Description
Member Typedef Documentation
◆ Pointer
|
inherited |
Definition at line 34 of file AsyncJob.h.
Constructor & Destructor Documentation
◆ Strand() [1/2]
◆ Strand() [2/2]
|
private |
Member Function Documentation
◆ callEnd()
|
virtualinherited |
called right after the called job method
Reimplemented in Adaptation::Icap::Xaction.
Definition at line 152 of file AsyncJob.cc.
References assert, AsyncCall::debugLevel, debugs, AsyncCall::debugSection, AsyncJob::done(), AsyncJob::inCall, AsyncJob::started_, AsyncJob::status(), AsyncJob::swanSang_, AsyncJob::swanSong(), and AsyncJob::typeName.
Referenced by Adaptation::Icap::Xaction::callEnd(), and AsyncJob::deleteThis().
◆ callException()
|
virtualinherited |
Reimplemented in ConnStateData, ClientHttpRequest, Adaptation::Icap::ModXact, Adaptation::Icap::ServiceRep, Adaptation::Icap::Xaction, Ipc::Forwarder, Ipc::Inquirer, and Ftp::Server.
Definition at line 143 of file AsyncJob.cc.
References cbdataReferenceValid(), debugs, Must, AsyncJob::mustStop(), and CbdataParent::toCbdata().
Referenced by ConnStateData::callException(), Adaptation::Icap::Xaction::callException(), Ipc::Forwarder::callException(), Ipc::Inquirer::callException(), and Ftp::Server::callException().
◆ callStart()
|
inherited |
called just before the called method
Definition at line 130 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 117 of file AsyncJob.cc.
References AsyncCall::cancel(), debugs, and AsyncJob::inCall.
◆ CBDATA_CHILD()
|
private |
◆ clearTimeout()
|
protectedinherited |
Definition at line 62 of file UdsOp.cc.
References commUnsetConnTimeout(), and conn.
◆ conn()
|
protectedinherited |
Definition at line 41 of file UdsOp.cc.
References COMM_DOBIND, comm_open_uds(), Comm::IsConnOpen(), and Must.
◆ CoordinatorAddr()
|
staticinherited |
Definition at line 65 of file Port.cc.
References String::append(), SBuf::c_str(), channelPathPfx, coordinatorAddrLabel, service_name, and String::size().
Referenced by Ipc::StrandMessage::NotifyCoordinator(), IpcIoFile::open(), Mgr::Action::sendResponse(), Snmp::SendResponse(), SendSharedListenRequest(), and Ipc::Forwarder::start().
◆ deleteThis()
|
protectedinherited |
Definition at line 65 of file AsyncJob.cc.
References asyncCall(), AsyncJob::callEnd(), debugs, AsyncJob::deleteThis(), AsyncJob::inCall, JobMemFun(), Must, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by ConnStateData::connStateClosed(), and AsyncJob::deleteThis().
◆ doListen()
|
protectedinherited |
Definition at line 37 of file Port.cc.
References comm_read(), conn, debugs, JobCallback, MYNAME, and Ipc::Port::noteRead().
◆ done()
|
protectedinherited |
Definition at line 106 of file AsyncJob.cc.
References AsyncJob::doneAll(), and AsyncJob::stopReason.
Referenced by AsyncJob::callEnd(), HappyConnOpener::checkForNewConnection(), Downloader::downloadFinished(), and HappyConnOpener::maybeOpenPrimeConnection().
◆ doneAll()
|
overrideprotectedvirtualinherited |
◆ finalizedInCbdataChild()
|
privatepure virtualinherited |
◆ handleCacheMgrRequest()
|
private |
Definition at line 133 of file Strand.cc.
References action(), CacheManager::createRequestedAction(), CacheManager::GetInstance(), and Mgr::Request::params.
◆ handleCacheMgrResponse()
|
private |
Definition at line 140 of file Strand.cc.
References Ipc::Forwarder::HandleRemoteAck(), and Ipc::Response::requestId.
◆ handleRegistrationResponse()
|
private |
Definition at line 120 of file Strand.cc.
References debugs, Ipc::StrandCoord::kidId, KidIdentifier, Ipc::StrandCoord::pid, and Ipc::StrandMessage::strand.
◆ handleSnmpRequest()
|
private |
Definition at line 146 of file Strand.cc.
References debugs, MYNAME, Snmp::Request::pdu, Ipc::Request::requestId, and Snmp::SendResponse().
◆ handleSnmpResponse()
|
private |
Definition at line 152 of file Strand.cc.
References debugs, Ipc::Forwarder::HandleRemoteAck(), MYNAME, and Ipc::Response::requestId.
◆ handleStopRequest()
|
inlineinherited |
Definition at line 73 of file AsyncJob.h.
References AsyncJob::mustStop().
◆ MakeAddr()
Definition at line 52 of file Port.cc.
References String::append(), assert, SBuf::c_str(), channelPathPfx, service_name, and xitoa().
Referenced by Ipc::Inquirer::inquire(), IpcIoFile::Notify(), and CollapsedForwarding::Notify().
◆ mustStop()
|
protectedinherited |
Definition at line 85 of file AsyncJob.cc.
References debugs, AsyncJob::inCall, Must, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by HttpStateData::abortAll(), AsyncJob::callException(), HttpStateData::continueAfterParsingHeader(), HttpStateData::drop1xx(), HttpStateData::handleMoreRequestBodyAvailable(), AsyncJob::handleStopRequest(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), HttpStateData::proceedAfter1xx(), ConnStateData::proxyProtocolError(), HttpStateData::readReply(), HttpStateData::start(), and HttpStateData::wroteLast().
◆ noteRead()
|
privateinherited |
Definition at line 96 of file Port.cc.
References assert, CommIoCbParams::buf, CommCommonCbParams::conn, debugs, CommCommonCbParams::flag, and Comm::OK.
Referenced by Ipc::Port::doListen().
◆ noteTimeout()
|
privateinherited |
Definition at line 67 of file UdsOp.cc.
Referenced by Ipc::UdsOp::setTimeout().
◆ operator=()
◆ receive()
|
overrideprotectedvirtual |
handle IPC message just read kids must call parent method when they do not recognize the message type
Implements Ipc::Port.
Definition at line 61 of file Strand.cc.
References CollapsedForwarding::HandleNotification(), IpcIoFile::HandleNotification(), IpcIoFile::HandleOpenResponse(), Ipc::Mine(), Ipc::mtCacheMgrRequest, Ipc::mtCacheMgrResponse, Ipc::mtCollapsedForwardingNotification, Ipc::mtIpcIoNotification, Ipc::mtSharedListenResponse, Ipc::mtSnmpRequest, Ipc::mtSnmpResponse, Ipc::mtStrandReady, Ipc::mtStrandRegistered, Ipc::TypedMsgHdr::rawType(), Ipc::Port::receive(), and Ipc::SharedListenJoined().
◆ receiveOrIgnore()
|
privateinherited |
Definition at line 85 of file Port.cc.
References CurrentException(), DBG_IMPORTANT, debugs, Debug::Extra(), and Ipc::TypedMsgHdr::rawType().
◆ registerSelf()
|
private |
Definition at line 52 of file Strand.cc.
References debugs, Ipc::mtRegisterStrand, Must, MYNAME, and Ipc::StrandMessage::NotifyCoordinator().
◆ RegisterWithCacheManager()
|
staticinherited |
Definition at line 215 of file AsyncJob.cc.
References Mgr::RegisterAction(), and AsyncJob::ReportAllJobs().
Referenced by mainInitialize().
◆ ReportAllJobs()
|
staticprotectedinherited |
Definition at line 198 of file AsyncJob.cc.
References AllJobs().
Referenced by AsyncJob::RegisterWithCacheManager().
◆ setOptions()
|
protectedinherited |
Definition at line 35 of file UdsOp.cc.
Referenced by Ipc::Port::Port().
◆ setTimeout()
|
protectedinherited |
Definition at line 54 of file UdsOp.cc.
References asyncCall(), commSetConnTimeout(), conn, handler(), and Ipc::UdsOp::noteTimeout().
◆ start()
|
overridevirtual |
◆ Start()
|
staticinherited |
Promises to start the configured job (eventually). The job is deemed to be running asynchronously beyond this point, so the caller should only access the job object via AsyncCalls rather than directly.
swanSong() is only called for jobs for which this method has returned successfully (i.e. without throwing).
Definition at line 37 of file AsyncJob.cc.
References CallJobHere, AsyncJob::start(), and AsyncJob::started_.
Referenced by Ftp::Server::AcceptCtrlConnection(), clientListenerConnectionOpened(), Ipc::Coordinator::handleCacheMgrRequest(), Ipc::Coordinator::handleSnmpRequest(), httpAccept(), httpsAccept(), httpStart(), idnsInitVC(), Ftp::Gateway::listenForDataChannel(), Ftp::Server::listenForDataConnection(), Log::TcpLogger::Open(), peerProbeConnect(), Mgr::FunAction::respond(), Mgr::InfoAction::respond(), Ipc::SendMessage(), Mgr::Inquirer::sendResponse(), snmpConstructReponse(), SquidMain(), CacheManager::start(), Adaptation::AccessCheck::Start(), Rock::Rebuild::Start(), JobWaitBase::start_(), BodyPipe::startAutoConsumptionIfNeeded(), Ftp::StartGateway(), Ftp::StartRelay(), PeerPoolMgrsRr::syncConfig(), and Rock::SwapDir::updateHeaders().
◆ status()
|
protectedvirtualinherited |
for debugging, starts with space
Reimplemented in Adaptation::Ecap::XactionRep, Adaptation::Icap::ServiceRep, Adaptation::Icap::Xaction, Adaptation::Initiate, Http::Tunneler, Comm::TcpAcceptor, HappyConnOpener, Ipc::Inquirer, and Security::PeerConnector.
Definition at line 182 of file AsyncJob.cc.
References MemBuf::append(), Packable::appendf(), MemBuf::content(), MemBuf::reset(), AsyncJob::stopReason, and MemBuf::terminate().
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), Adaptation::Initiate::status(), and Comm::TcpAcceptor::status().
◆ swanSong()
|
inlineprotectedvirtualinherited |
Reimplemented in Adaptation::Ecap::XactionRep, Adaptation::Icap::Launcher, Adaptation::Icap::ModXact, Adaptation::Icap::ModXactLauncher, Adaptation::Icap::OptXact, Adaptation::Icap::Xaction, Adaptation::Initiate, Adaptation::Iterator, ConnStateData, Client, Ftp::Relay, Http::Tunneler, Comm::ConnOpener, Comm::TcpAcceptor, Downloader, Rock::HeaderUpdater, Rock::Rebuild, HappyConnOpener, Ipc::Forwarder, Ipc::Inquirer, Ipc::UdsSender, Log::TcpLogger, Mgr::Filler, Mgr::Forwarder, Mgr::StoreToCommWriter, PeerPoolMgr, Security::PeerConnector, Server, and Snmp::Forwarder.
Definition at line 61 of file AsyncJob.h.
Referenced by AsyncJob::callEnd(), Client::swanSong(), Http::Tunneler::swanSong(), Comm::ConnOpener::swanSong(), Comm::TcpAcceptor::swanSong(), Rock::HeaderUpdater::swanSong(), HappyConnOpener::swanSong(), Ipc::UdsSender::swanSong(), Log::TcpLogger::swanSong(), PeerPoolMgr::swanSong(), Security::PeerConnector::swanSong(), and Server::swanSong().
◆ timedout()
|
overrideprotectedvirtual |
Reimplemented from Ipc::UdsOp.
Definition at line 159 of file Strand.cc.
References debugs, fatalf(), and KidIdentifier.
◆ toCbdata()
|
pure virtualinherited |
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
Member Data Documentation
◆ address
|
inherited |
Definition at line 37 of file UdsOp.h.
Referenced by Ipc::UdsSender::UdsSender().
◆ buf
|
privateinherited |
◆ conn_
|
privateinherited |
◆ id
|
inherited |
Definition at line 75 of file AsyncJob.h.
◆ inCall
|
protectedinherited |
Definition at line 86 of file AsyncJob.h.
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::canBeCalled(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
◆ isRegistered
◆ options
◆ started_
|
protectedinherited |
Definition at line 88 of file AsyncJob.h.
Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().
◆ stopReason
|
protectedinherited |
Definition at line 84 of file AsyncJob.h.
Referenced by AsyncJob::deleteThis(), AsyncJob::done(), AsyncJob::mustStop(), AsyncJob::status(), and HappyConnOpener::status().
◆ swanSang_
|
protectedinherited |
Definition at line 89 of file AsyncJob.h.
Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().
◆ typeName
|
protectedinherited |
Definition at line 85 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: