|
Squid Web Cache master
|
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 | |
| void | callStart (AsyncCall &call) |
| virtual void | callEnd () |
| called right after the called job method | |
| virtual void | callException (const std::exception &e) |
| called when the job throws during an async call | |
| void | handleStopRequest () |
| process external request to terminate now (i.e. during this async call) | |
| 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 | |
| static String | CoordinatorAddr () |
| get the IPC message address for coordinator process | |
| static void | Start (const Pointer &job) |
| static void | RegisterWithCacheManager () |
Public Attributes | |
| struct sockaddr_un | address |
| UDS address from path; treat as read-only. | |
| const InstanceId< AsyncJob > | id |
| job identifier | |
Protected Member Functions | |
| void | start () override=0 |
| called by AsyncStart; do not call directly | |
| bool | doneAll () const override |
| whether positive goal has been reached | |
| void | doListen () |
| read the next incoming message | |
| virtual void | receive (const TypedMsgHdr &)=0 |
| virtual void | timedout () |
| called after setTimeout() if timed out | |
| Comm::ConnectionPointer & | conn () |
| creates if needed and returns raw UDS socket descriptor | |
| void | setTimeout (time_t seconds, const char *handlerName) |
| call timedout() if no UDS messages in a given number of seconds | |
| void | clearTimeout () |
| remove previously set timeout, if any | |
| void | setOptions (int newOptions) |
| changes socket options | |
| void | deleteThis (const char *aReason) |
| void | mustStop (const char *aReason) |
| bool | done () const |
| the job is destroyed in callEnd() when done() | |
| virtual void | swanSong () |
| virtual const char * | status () const |
| internal cleanup; do not call directly | |
Static Protected Member Functions | |
| static void | ReportAllJobs (StoreEntry *) |
| writes a cache manager report about all jobs existing in this worker | |
Protected Attributes | |
| const char * | stopReason |
| reason for forcing done() to be true | |
| const char * | typeName |
| kid (leaf) class name, for debugging | |
| AsyncCall::Pointer | inCall |
| the asynchronous call being handled, if any | |
| bool | started_ = false |
| Start() has finished successfully. | |
| bool | swanSang_ = false |
| swanSong() was called | |
Private Member Functions | |
| void | noteRead (const CommIoCbParams ¶ms) |
| void | receiveOrIgnore (const TypedMsgHdr &) |
| receive() but ignore any errors | |
| void | noteTimeout (const CommTimeoutCbParams &p) |
| Comm timeout callback; calls timedout() | |
| virtual void | finalizedInCbdataChild ()=0 |
| hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() | |
Private Attributes | |
| TypedMsgHdr | buf |
| msghdr struct filled by Comm | |
| int | options |
| UDS options. | |
| Comm::ConnectionPointer | conn_ |
| UDS descriptor. | |
|
inherited |
Definition at line 34 of file AsyncJob.h.
| Ipc::Port::Port | ( | const String & | aListenAddr | ) |
Definition at line 26 of file Port.cc.
References COMM_DOBIND, COMM_NONBLOCKING, and Ipc::UdsOp::setOptions().
|
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().
|
virtualinherited |
Reimplemented in ConnStateData, ClientHttpRequest, Rock::Rebuild, 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().
|
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.
|
inherited |
Definition at line 117 of file AsyncJob.cc.
References AsyncCall::cancel(), debugs, and AsyncJob::inCall.
|
protectedinherited |
Definition at line 63 of file UdsOp.cc.
References commUnsetConnTimeout().
|
protectedinherited |
Definition at line 42 of file UdsOp.cc.
References COMM_DOBIND, comm_open_uds(), Comm::Connection::fd, Comm::IsConnOpen(), and Must.
|
static |
Definition at line 65 of file Port.cc.
References String::append(), channelPathPfx, coordinatorAddrLabel, Instance::NamePrefix(), and String::size().
Referenced by Ipc::StrandMessage::NotifyCoordinator(), IpcIoFile::open(), Mgr::Action::sendResponse(), Snmp::SendResponse(), SendSharedListenRequest(), and Ipc::Forwarder::start().
|
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().
|
protected |
Definition at line 38 of file Port.cc.
References comm_read(), debugs, JobCallback, MYNAME, and noteRead().
|
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().
|
overrideprotectedvirtual |
|
privatepure virtualinherited |
|
inlineinherited |
Definition at line 73 of file AsyncJob.h.
References AsyncJob::mustStop().
Definition at line 53 of file Port.cc.
References String::append(), assert, channelPathPfx, Instance::NamePrefix(), and xitoa().
Referenced by Ipc::Inquirer::inquire(), IpcIoFile::Notify(), and CollapsedForwarding::Notify().
|
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(), AsyncJob::handleStopRequest(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), HttpStateData::proceedAfter1xx(), ConnStateData::proxyProtocolError(), HttpStateData::readReply(), HttpStateData::start(), and HttpStateData::wroteLast().
|
private |
Definition at line 94 of file Port.cc.
References assert, CommIoCbParams::buf, CommCommonCbParams::conn, debugs, CommCommonCbParams::flag, and Comm::OK.
Referenced by doListen().
|
privateinherited |
Definition at line 68 of file UdsOp.cc.
Referenced by Ipc::UdsOp::setTimeout().
|
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 76 of file Port.cc.
References Here, Ipc::TypedMsgHdr::rawType(), and ToSBuf().
Referenced by Ipc::Coordinator::receive(), and Ipc::Strand::receive().
|
private |
Definition at line 83 of file Port.cc.
References CurrentException(), DBG_IMPORTANT, debugs, Debug::Extra(), and Ipc::TypedMsgHdr::rawType().
|
staticinherited |
Definition at line 215 of file AsyncJob.cc.
References Mgr::RegisterAction(), and AsyncJob::ReportAllJobs().
Referenced by mainInitialize().
|
staticprotectedinherited |
Definition at line 198 of file AsyncJob.cc.
References AllJobs().
Referenced by AsyncJob::RegisterWithCacheManager().
|
protectedinherited |
|
protectedinherited |
Definition at line 55 of file UdsOp.cc.
References asyncCall(), commSetConnTimeout(), and Ipc::UdsOp::noteTimeout().
|
overrideprotectedpure virtual |
Reimplemented from AsyncJob.
Implemented in Ipc::Coordinator, and Ipc::Strand.
Definition at line 32 of file Port.cc.
References AsyncJob::start().
Referenced by Ipc::Coordinator::start(), and Ipc::Strand::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(), and Rock::SwapDir::updateHeaders().
|
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().
|
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(), Ftp::Relay::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().
|
inlineprotectedvirtualinherited |
Reimplemented in Ipc::Strand, and Ipc::UdsSender.
|
pure virtualinherited |
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
|
inherited |
Definition at line 37 of file UdsOp.h.
Referenced by Ipc::UdsSender::UdsSender().
|
private |
|
privateinherited |
|
inherited |
Definition at line 75 of file AsyncJob.h.
|
protectedinherited |
Definition at line 86 of file AsyncJob.h.
Referenced by AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::canBeCalled(), AsyncJob::deleteThis(), and AsyncJob::mustStop().
|
protectedinherited |
Definition at line 88 of file AsyncJob.h.
Referenced by AsyncJob::~AsyncJob(), AsyncJob::callEnd(), and AsyncJob::Start().
|
protectedinherited |
Definition at line 84 of file AsyncJob.h.
Referenced by AsyncJob::deleteThis(), AsyncJob::done(), AsyncJob::mustStop(), AsyncJob::status(), and HappyConnOpener::status().
|
protectedinherited |
Definition at line 89 of file AsyncJob.h.
Referenced by AsyncJob::~AsyncJob(), and AsyncJob::callEnd().
|
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().