Maintains an fixed-size "standby" PconnPool for a single CachePeer. More...
#include <PeerPoolMgr.h>
![Inheritance graph](classPeerPoolMgr__inherit__graph.png)
![Collaboration graph](classPeerPoolMgr__coll__graph.png)
Public Types | |
typedef CbcPointer< PeerPoolMgr > | Pointer |
Public Member Functions | |
PeerPoolMgr (CachePeer *aPeer) | |
~PeerPoolMgr () override | |
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 void | Checkpoint (const Pointer &mgr, const char *reason) |
static void | Start (const Pointer &job) |
static void | RegisterWithCacheManager () |
Public Attributes | |
PrecomputedCodeContextPointer | codeContext |
const InstanceId< AsyncJob > | id |
job identifier More... | |
Protected Member Functions | |
void | start () override |
called by AsyncStart; do not call directly More... | |
void | swanSong () override |
bool | doneAll () const override |
whether positive goal has been reached More... | |
bool | validPeer () const |
whether the peer is still out there and in a valid state we can safely use More... | |
void | checkpoint (const char *reason) |
void | openNewConnection () |
starts the process of opening a new standby connection (if possible) More... | |
void | closeOldConnections (const int howMany) |
closes 'howMany' standby connections More... | |
void | handleOpenedConnection (const CommConnectCbParams ¶ms) |
Comm::ConnOpener calls this when done opening a connection for us. More... | |
void | handleSecuredPeer (Security::EncryptorAnswer &answer) |
Security::PeerConnector callback. More... | |
void | pushNewConnection (const Comm::ConnectionPointer &conn) |
the final step in connection opening (and, optionally, securing) sequence 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... | |
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 (PeerPoolMgr) | |
virtual void | finalizedInCbdataChild ()=0 |
hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More... | |
Private Attributes | |
CachePeer * | peer |
the owner of the pool we manage More... | |
RefCount< HttpRequest > | request |
fake HTTP request for conn opening code More... | |
JobWait< Comm::ConnOpener > | transportWait |
waits for a transport connection to the peer to be established/opened More... | |
JobWait< Security::BlindPeerConnector > | encryptionWait |
waits for the established transport connection to be secured/encrypted More... | |
unsigned int | addrUsed |
counter for cycling through peer addresses More... | |
Detailed Description
Definition at line 23 of file PeerPoolMgr.h.
Member Typedef Documentation
◆ Pointer
typedef CbcPointer<PeerPoolMgr> PeerPoolMgr::Pointer |
Definition at line 28 of file PeerPoolMgr.h.
Constructor & Destructor Documentation
◆ PeerPoolMgr()
|
explicit |
Definition at line 33 of file PeerPoolMgr.cc.
References codeContext, Debug::Extra(), CachePeer::host, AnyP::Uri::host(), Http::METHOD_OPTIONS, peer, AnyP::PROTO_HTTP, request, ToSBuf(), and HttpRequest::url.
◆ ~PeerPoolMgr()
|
override |
Definition at line 50 of file PeerPoolMgr.cc.
References cbdataReferenceDone, and peer.
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 Adaptation::Icap::ModXact, Adaptation::Icap::Xaction, Adaptation::Icap::ServiceRep, Ftp::Server, Ipc::Forwarder, Ipc::Inquirer, ConnStateData, ClientHttpRequest, and Rock::Rebuild.
Definition at line 143 of file AsyncJob.cc.
References cbdataReferenceValid(), debugs, Must, AsyncJob::mustStop(), and CbdataParent::toCbdata().
Referenced by Ipc::Inquirer::callException(), Ipc::Forwarder::callException(), Ftp::Server::callException(), Adaptation::Icap::Xaction::callException(), and ConnStateData::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 |
◆ checkpoint()
|
protected |
Starts new connection, or closes the excess connections according pool configuration
Definition at line 214 of file PeerPoolMgr.cc.
References closeOldConnections(), PconnPool::count(), debugs, CachePeer::limit, openNewConnection(), peer, CachePeer::pool, CachePeer::standby, and validPeer().
Referenced by handleOpenedConnection(), handleSecuredPeer(), and start().
◆ Checkpoint()
|
static |
Definition at line 232 of file PeerPoolMgr.cc.
References CallService(), and debugs.
Referenced by PconnPool::notifyManager(), peerAlive(), peerConnClosed(), peerDNSConfigure(), and CachePeer::~CachePeer().
◆ closeOldConnections()
|
protected |
Definition at line 207 of file PeerPoolMgr.cc.
References PconnPool::closeN(), debugs, peer, CachePeer::pool, and CachePeer::standby.
Referenced by checkpoint().
◆ deleteThis()
|
protectedinherited |
Definition at line 65 of file AsyncJob.cc.
References asyncCall(), AsyncJob::callEnd(), debugs, AsyncJob::inCall, JobMemFun(), Must, AsyncJob::stopReason, and AsyncJob::typeName.
Referenced by ConnStateData::connStateClosed().
◆ 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 |
Reimplemented from AsyncJob.
Definition at line 75 of file PeerPoolMgr.cc.
References AsyncJob::doneAll(), CachePeer::limit, peer, CachePeer::standby, and validPeer().
◆ finalizedInCbdataChild()
|
privatepure virtualinherited |
◆ handleOpenedConnection()
|
protected |
Definition at line 81 of file PeerPoolMgr.cc.
References asyncCallback, checkpoint(), Comm::Connection::close(), CommCommonCbParams::conn, CachePeer::connectTimeout(), debugs, encryptionWait, Security::PeerOptions::encryptTransport, CommCommonCbParams::flag, handleSecuredPeer(), Must, NoteOutgoingConnectionFailure(), Comm::OK, peer, positiveTimeout(), pushNewConnection(), request, CachePeer::secure, squid_curtime, JobWait< Job >::start(), Comm::Connection::startTime(), transportWait, and validPeer().
Referenced by openNewConnection().
◆ handleSecuredPeer()
|
protected |
Definition at line 127 of file PeerPoolMgr.cc.
References assert, checkpoint(), Comm::Connection::close(), Security::EncryptorAnswer::conn, debugs, encryptionWait, Security::EncryptorAnswer::error, Comm::Connection::fd, fd_table, CbcPointer< Cbc >::get(), Comm::Connection::isOpen(), Comm::Connection::noteClosure(), pushNewConnection(), Security::EncryptorAnswer::tunneled, and validPeer().
Referenced by handleOpenedConnection().
◆ handleStopRequest()
|
inlineinherited |
Definition at line 73 of file AsyncJob.h.
References AsyncJob::mustStop().
◆ 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().
◆ openNewConnection()
|
protected |
Definition at line 160 of file PeerPoolMgr.cc.
References CachePeer::addresses, addrUsed, CachePeer::connectTimeout(), debugs, encryptionWait, fdUsageHigh(), GetMarkingsToServer(), getOutgoingAddress(), RefCount< C >::getRaw(), handleOpenedConnection(), CachePeer::http_port, JobCallback, Must, CachePeer::n_addresses, neighborUp(), peer, peerCanOpenMore(), Comm::Connection::peerType, Ip::Address::port(), Comm::Connection::remote, request, Comm::Connection::setPeer(), shutting_down, CachePeer::standby, STANDBY_POOL, JobWait< Job >::start(), transportWait, and CachePeer::waitingForClose.
Referenced by checkpoint().
◆ pushNewConnection()
|
protected |
Definition at line 118 of file PeerPoolMgr.cc.
References Comm::IsConnOpen(), Must, peer, CachePeer::pool, PconnPool::push(), CachePeer::standby, and validPeer().
Referenced by handleOpenedConnection(), and handleSecuredPeer().
◆ 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().
◆ start()
|
overrideprotectedvirtual |
Reimplemented from AsyncJob.
Definition at line 56 of file PeerPoolMgr.cc.
References checkpoint(), and AsyncJob::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(), Adaptation::AccessCheck::Start(), CacheManager::start(), Rock::Rebuild::Start(), JobWaitBase::start_(), BodyPipe::startAutoConsumptionIfNeeded(), Ftp::StartGateway(), Ftp::StartRelay(), and Rock::SwapDir::updateHeaders().
◆ status()
|
protectedvirtualinherited |
for debugging, starts with space
Reimplemented in Adaptation::Icap::ServiceRep, HappyConnOpener, Adaptation::Icap::Xaction, Adaptation::Ecap::XactionRep, Security::PeerConnector, Http::Tunneler, Adaptation::Initiate, Comm::TcpAcceptor, and Ipc::Inquirer.
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(), Comm::TcpAcceptor::status(), and Adaptation::Initiate::status().
◆ swanSong()
|
overrideprotectedvirtual |
Reimplemented from AsyncJob.
Definition at line 63 of file PeerPoolMgr.cc.
References AsyncJob::swanSong().
◆ toCbdata()
|
pure virtualinherited |
Referenced by AsyncJob::callException(), and AsyncJob::callStart().
◆ validPeer()
|
protected |
Definition at line 69 of file PeerPoolMgr.cc.
References cbdataReferenceValid(), peer, CachePeer::pool, and CachePeer::standby.
Referenced by checkpoint(), doneAll(), handleOpenedConnection(), handleSecuredPeer(), and pushNewConnection().
Member Data Documentation
◆ addrUsed
|
private |
Definition at line 74 of file PeerPoolMgr.h.
Referenced by openNewConnection().
◆ codeContext
PrecomputedCodeContextPointer PeerPoolMgr::codeContext |
Definition at line 36 of file PeerPoolMgr.h.
Referenced by PeerPoolMgr().
◆ encryptionWait
|
private |
Definition at line 72 of file PeerPoolMgr.h.
Referenced by handleOpenedConnection(), handleSecuredPeer(), and openNewConnection().
◆ 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().
◆ peer
|
private |
Definition at line 65 of file PeerPoolMgr.h.
Referenced by checkpoint(), closeOldConnections(), doneAll(), handleOpenedConnection(), openNewConnection(), PeerPoolMgr(), pushNewConnection(), validPeer(), and ~PeerPoolMgr().
◆ request
|
private |
Definition at line 66 of file PeerPoolMgr.h.
Referenced by handleOpenedConnection(), openNewConnection(), and PeerPoolMgr().
◆ started_
|
protectedinherited |
Definition at line 88 of file AsyncJob.h.
Referenced by AsyncJob::callEnd(), AsyncJob::Start(), and AsyncJob::~AsyncJob().
◆ 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::callEnd(), and AsyncJob::~AsyncJob().
◆ transportWait
|
private |
Definition at line 69 of file PeerPoolMgr.h.
Referenced by handleOpenedConnection(), and openNewConnection().
◆ typeName
|
protectedinherited |
Definition at line 85 of file AsyncJob.h.
Referenced by AsyncJob::AsyncJob(), AsyncJob::callEnd(), AsyncJob::callStart(), AsyncJob::deleteThis(), AsyncJob::mustStop(), Adaptation::Icap::Xaction::Xaction(), and AsyncJob::~AsyncJob().
The documentation for this class was generated from the following files:
- src/PeerPoolMgr.h
- src/PeerPoolMgr.cc
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products