#include <pconn.h>

Collaboration diagram for PconnPool:

Public Member Functions

 PconnPool (const char *aDescription, const CbcPointer< PeerPoolMgr > &aMgr)
 ~PconnPool ()
void moduleInit ()
void push (const Comm::ConnectionPointer &serverConn, const char *domain)
Comm::ConnectionPointer pop (const Comm::ConnectionPointer &dest, const char *domain, bool keepOpen)
void count (int uses)
void dumpHist (StoreEntry *e) const
void dumpHash (StoreEntry *e) const
void unlinkList (IdleConnList *list)
void noteUses (int uses)
void closeN (int n)
 closes any n connections, regardless of their destination More...
int count () const
void noteConnectionAdded ()
void noteConnectionRemoved ()
void notifyManager (const char *reason)

Static Private Member Functions

static const char * key (const Comm::ConnectionPointer &destLink, const char *domain)

Private Attributes

int hist [PCONN_HIST_SZ]
const char * descr
CbcPointer< PeerPoolMgrmgr
 optional pool manager (for notifications) More...
int theCount
 the number of pooled connections More...

Detailed Description

Manages idle persistent connections to a caller-defined set of servers (e.g., all HTTP servers). Uses a collection of IdleConnLists internally to list the individual open connections to each server. Controls lists existence and limits the total number of idle connections across the collection.

Definition at line 114 of file pconn.h.

Constructor & Destructor Documentation

PconnPool::PconnPool ( const char *  aDescription,
const CbcPointer< PeerPoolMgr > &  aMgr 
PconnPool::~PconnPool ( )

Member Function Documentation

void PconnPool::closeN ( int  n)

Definition at line 478 of file pconn.cc.

References count(), hash_first(), hash_next(), i, Must, and table.

Referenced by PeerPoolMgr::closeOldConnections().

void PconnPool::count ( int  uses)
int PconnPool::count ( ) const

Definition at line 143 of file pconn.h.

References theCount.

Referenced by closeN().

void PconnPool::dumpHash ( StoreEntry e) const

Definition at line 364 of file pconn.cc.

References hash_first(), hash_next(), i, storeAppendPrintf(), and table.

void PconnPool::dumpHist ( StoreEntry e) const

Definition at line 346 of file pconn.cc.

References descr, hist, i, PCONN_HIST_SZ, and storeAppendPrintf().

const char * PconnPool::key ( const Comm::ConnectionPointer destLink,
const char *  domain 

Definition at line 331 of file pconn.cc.

References buf, debugs, LOCAL_ARRAY, Comm::Connection::remote, SQUIDHOSTNAMELEN, and Ip::Address::toUrl().

Referenced by pop(), and push().

void PconnPool::moduleInit ( )
void PconnPool::noteConnectionAdded ( )

Definition at line 144 of file pconn.h.

References theCount.

Referenced by IdleConnList::push().

void PconnPool::noteConnectionRemoved ( )

Definition at line 145 of file pconn.h.

References assert, and theCount.

Referenced by IdleConnList::closeN(), and IdleConnList::removeAt().

void PconnPool::noteUses ( int  uses)

Definition at line 507 of file pconn.cc.

References hist, and PCONN_HIST_SZ.

Referenced by FwdState::closeServerConnection(), and FwdState::serverClosed().

void PconnPool::notifyManager ( const char *  reason)

Definition at line 471 of file pconn.cc.

References PeerPoolMgr::Checkpoint(), mgr, and CbcPointer< Cbc >::valid().

Referenced by IdleConnList::findAndClose(), pop(), and push().

Comm::ConnectionPointer PconnPool::pop ( const Comm::ConnectionPointer dest,
const char *  domain,
bool  keepOpen 

Returns either a pointer to a popped connection to dest or nil. Closes the connection before returning its pointer unless keepOpen.

A caller with a non-retriable transaction should set keepOpen to false and call pop() anyway, even though the caller does not want a pconn. This forces us to close an available persistent connection, avoiding creating a growing number of open connections when many transactions create (and push) persistent connections but are not retriable and, hence, do not need to pop a connection.

Definition at line 444 of file pconn.cc.

References Comm::Connection::close(), debugs, IdleConnList::findUseable(), hash_lookup(), hashKeyStr(), HERE(), Comm::IsConnOpen(), key(), notifyManager(), NULL, and table.

Referenced by FwdState::pconnPop().

void PconnPool::unlinkList ( IdleConnList list)

Definition at line 499 of file pconn.cc.

References assert, IdleConnList::count(), hash_remove_link(), table, and theCount.

Referenced by IdleConnList::~IdleConnList().

Member Data Documentation

const char* PconnPool::descr

Definition at line 156 of file pconn.h.

Referenced by dumpHist(), and ~PconnPool().

int PconnPool::hist[PCONN_HIST_SZ]

Definition at line 154 of file pconn.h.

Referenced by dumpHist(), noteUses(), and PconnPool().

CbcPointer<PeerPoolMgr> PconnPool::mgr

Definition at line 157 of file pconn.h.

Referenced by notifyManager().

hash_table* PconnPool::table

Definition at line 155 of file pconn.h.

Referenced by closeN(), dumpHash(), PconnPool(), pop(), push(), unlinkList(), and ~PconnPool().

int PconnPool::theCount

Definition at line 158 of file pconn.h.

Referenced by count(), noteConnectionAdded(), noteConnectionRemoved(), and unlinkList().

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






Web Site Translations