Waits for and receives incoming IPC messages; kids handle the messages. More...
#include <Port.h>
Public Types | |
typedef CbcPointer< AsyncJob > | Pointer |
Public Member Functions | |
Port (const String &aListenAddr) | |
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 | start () override=0 |
called by AsyncStart; do not call directly More... | |
bool | doneAll () const override |
whether positive goal has been reached More... | |
void | doListen () |
read the next incoming message More... | |
virtual void | receive (const TypedMsgHdr &)=0 |
virtual void | timedout () |
called after setTimeout() if timed out 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 | |
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 | |
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
◆ Port()
Ipc::Port::Port | ( | const String & | aListenAddr | ) |
Definition at line 25 of file Port.cc.
References COMM_DOBIND, COMM_NONBLOCKING, and Ipc::UdsOp::setOptions().
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.
◆ 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()
|
static |
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()
|
protected |
Definition at line 37 of file Port.cc.
References comm_read(), conn, debugs, JobCallback, MYNAME, and 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()
|
overrideprotectedvirtual |
◆ finalizedInCbdataChild()
|
privatepure virtualinherited |
◆ 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()
|
private |
Definition at line 96 of file Port.cc.
References assert, CommIoCbParams::buf, CommCommonCbParams::conn, debugs, CommCommonCbParams::flag, and Comm::OK.
Referenced by doListen().
◆ noteTimeout()
|
privateinherited |
Definition at line 67 of file UdsOp.cc.
Referenced by Ipc::UdsOp::setTimeout().
◆ receive()
|
protectedpure virtual |
handle IPC message just read kids must call parent method when they do not recognize the message type
Implemented in Ipc::Coordinator, and Ipc::Strand.
Definition at line 78 of file Port.cc.
References Here, Ipc::TypedMsgHdr::rawType(), and ToSBuf().
Referenced by Ipc::Coordinator::receive(), and Ipc::Strand::receive().
◆ receiveOrIgnore()
|
private |
Definition at line 85 of file Port.cc.
References CurrentException(), DBG_IMPORTANT, debugs, Debug::Extra(), and Ipc::TypedMsgHdr::rawType().
◆ 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 |
◆ setTimeout()
|
protectedinherited |
Definition at line 54 of file UdsOp.cc.
References asyncCall(), commSetConnTimeout(), conn, handler(), and Ipc::UdsOp::noteTimeout().
◆ start()
|
overrideprotectedpure virtual |
Reimplemented from AsyncJob.
Implemented in Ipc::Coordinator, and Ipc::Strand.
Definition at line 31 of file Port.cc.
References AsyncJob::start().
Referenced by Ipc::Coordinator::start(), and Ipc::Strand::start().
◆ 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()
|
inlineprotectedvirtualinherited |
Reimplemented in Ipc::Strand, and Ipc::UdsSender.
◆ 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
|
private |
◆ 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().
◆ 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: