Maintains an fixed-size "standby" PconnPool for a single CachePeer. More...

#include <PeerPoolMgr.h>

Inheritance diagram for PeerPoolMgr:
Collaboration diagram for PeerPoolMgr:

Public Types

typedef CbcPointer< PeerPoolMgrPointer

Public Member Functions

 PeerPoolMgr (CachePeer *aPeer)
virtual ~PeerPoolMgr ()
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...
virtual void * toCbdata ()=0

Static Public Member Functions

static void Checkpoint (const Pointer &mgr, const char *reason)
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) 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...
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 &params)
 Comm::ConnOpener calls this when done opening a connection for us. More...
void handleSecuredPeer (Security::EncryptorAnswer &answer)
 Security::PeerConnector callback. More...
void handleSecureClosure (const CommCloseCbParams &params)
 called when the connection we are trying to secure is closed by a 3rd party 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...

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...
const InstanceId< AsyncJobid
 job identifier More...

Private Member Functions


Private Attributes

 the owner of the pool we manage More...
RefCount< HttpRequestrequest
 fake HTTP request for conn opening code More...
AsyncCall::Pointer opener
 whether we are opening a connection More...
AsyncCall::Pointer securer
 whether we are securing a connection More...
AsyncCall::Pointer closer
 monitors conn while we are securing it More...
unsigned int addrUsed
 counter for cycling through peer addresses More...

Detailed Description

Definition at line 21 of file PeerPoolMgr.h.

Member Typedef Documentation

Definition at line 26 of file PeerPoolMgr.h.

Constructor & Destructor Documentation

PeerPoolMgr::PeerPoolMgr ( CachePeer aPeer)

Definition at line 43 of file

PeerPoolMgr::~PeerPoolMgr ( )

Definition at line 53 of file

References cbdataReferenceDone, and peer.

Member Function Documentation

void AsyncJob::callEnd ( )
void AsyncJob::callStart ( AsyncCall call)
bool AsyncJob::canBeCalled ( AsyncCall call) const

Definition at line 101 of file

References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.

PeerPoolMgr::CBDATA_CLASS ( PeerPoolMgr  )
void PeerPoolMgr::Checkpoint ( const Pointer mgr,
const char *  reason 
void PeerPoolMgr::checkpoint ( const char *  reason)

Starts new connection, or closes the excess connections according pool configuration

Definition at line 243 of file

References closeOldConnections(), PconnPool::count(), debugs, CachePeer::limit, openNewConnection(), peer, CachePeer::pool, CachePeer::standby, and validPeer().

Referenced by Checkpoint(), handleOpenedConnection(), handleSecuredPeer(), and start().

void PeerPoolMgr::closeOldConnections ( const int  howMany)

Definition at line 236 of file

References PconnPool::closeN(), debugs, peer, CachePeer::pool, and CachePeer::standby.

Referenced by checkpoint().

void AsyncJob::deleteThis ( const char *  aReason)
bool AsyncJob::done ( ) const

Definition at line 90 of file

References AsyncJob::doneAll(), NULL, and AsyncJob::stopReason.

Referenced by AsyncJob::callEnd(), and Downloader::downloadFinished().

bool PeerPoolMgr::doneAll ( ) const

Reimplemented from AsyncJob.

Definition at line 85 of file

References AsyncJob::doneAll(), CachePeer::limit, peer, CachePeer::standby, and validPeer().

void PeerPoolMgr::handleSecureClosure ( const CommCloseCbParams params)

Definition at line 177 of file

References AsyncCall::cancel(), Checkpoint(), closer, Must, NULL, and securer.

Referenced by handleOpenedConnection().

void PeerPoolMgr::pushNewConnection ( const Comm::ConnectionPointer conn)
void PeerPoolMgr::start ( )
void PeerPoolMgr::swanSong ( )

Reimplemented from AsyncJob.

Definition at line 73 of file

References AsyncJob::swanSong().

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited
bool PeerPoolMgr::validPeer ( ) const

Member Data Documentation

unsigned int PeerPoolMgr::addrUsed

Definition at line 69 of file PeerPoolMgr.h.

Referenced by openNewConnection().

AsyncCall::Pointer PeerPoolMgr::closer

Definition at line 68 of file PeerPoolMgr.h.

Referenced by handleOpenedConnection(), handleSecureClosure(), and handleSecuredPeer().

const InstanceId<AsyncJob> AsyncJob::id

Definition at line 72 of file AsyncJob.h.

AsyncCall::Pointer AsyncJob::inCall
AsyncCall::Pointer PeerPoolMgr::opener

Definition at line 66 of file PeerPoolMgr.h.

Referenced by handleOpenedConnection(), and openNewConnection().

RefCount<HttpRequest> PeerPoolMgr::request

Definition at line 65 of file PeerPoolMgr.h.

Referenced by handleOpenedConnection(), openNewConnection(), and start().

AsyncCall::Pointer PeerPoolMgr::securer
const char* AsyncJob::stopReason

The documentation for this class was generated from the following files:






Web Site Translations