#include <pconn.h>

Inheritance diagram for IdleConnList:
Collaboration diagram for IdleConnList:

Public Member Functions

void * operator new (size_t size)
 
void operator delete (void *address)
 
void * toCbdata () noexcept
 
 IdleConnList (const char *key, PconnPool *parent)
 
 ~IdleConnList ()
 
void push (const Comm::ConnectionPointer &conn)
 Pass control of the connection to the idle list. More...
 
Comm::ConnectionPointer pop ()
 get first conn which is not pending read fd. More...
 
Comm::ConnectionPointer findUseable (const Comm::ConnectionPointer &key)
 
void clearHandlers (const Comm::ConnectionPointer &conn)
 
int count () const
 
void closeN (size_t count)
 
virtual void endingShutdown ()
 

Public Attributes

void * key
 
hash_linknext
 

Private Types

typedef void(RegisteredRunner::* Method )()
 a pointer to one of the above notification methods More...
 

Private Member Functions

bool isAvailable (int i) const
 
bool removeAt (int index)
 
int findIndexOf (const Comm::ConnectionPointer &conn) const
 
void findAndClose (const Comm::ConnectionPointer &conn)
 
void registerRunner ()
 
void unregisterRunner ()
 unregisters self; safe to call multiple times More...
 
virtual void finalizeConfig ()
 
virtual void claimMemoryNeeds ()
 
virtual void useConfig ()
 
virtual void startReconfigure ()
 
virtual void syncConfig ()
 
virtual void startShutdown ()
 
virtual void finishShutdown ()
 Meant for cleanup of services needed by the already destroyed objects. More...
 

Private Attributes

Comm::ConnectionPointertheList_
 
int capacity_
 Number of entries theList can currently hold without re-allocating (capacity). More...
 
int size_
 
PconnPoolparent_
 
char fakeReadBuf_ [4096]
 

Static Private Attributes

static cbdata_type CBDATA_IdleConnList = CBDATA_UNKNOWN
 
static IOCB Read
 
static CTCB Timeout
 

Detailed Description

A list of connections currently open to a particular destination end-point.

Definition at line 39 of file pconn.h.

Member Typedef Documentation

typedef void(RegisteredRunner::* RegisteredRunner::Method)()
inherited

Definition at line 90 of file RunnersRegistry.h.

Constructor & Destructor Documentation

IdleConnList::IdleConnList ( const char *  key,
PconnPool parent 
)
IdleConnList::~IdleConnList ( )

Definition at line 50 of file pconn.cc.

References closeN(), hash_link::key, NULL, parent_, size_, theList_, PconnPool::unlinkList(), and xfree.

Member Function Documentation

virtual void RegisteredRunner::claimMemoryNeeds ( )
inlinevirtualinherited

Called after finalizeConfig(). Meant for announcing memory reservations before memory is allocated.

Reimplemented in MemStoreRr, and IpcIoRr.

Definition at line 51 of file RunnersRegistry.h.

Referenced by StartUsingConfig().

void IdleConnList::clearHandlers ( const Comm::ConnectionPointer conn)
void IdleConnList::closeN ( size_t  count)
int IdleConnList::count ( ) const
inline

Definition at line 63 of file pconn.h.

References size_.

Referenced by PconnPool::unlinkList().

void IdleConnList::endingShutdown ( )
virtual

Called after shutdown_lifetime grace period ends and before stopping the main loop. At least one main loop iteration is guaranteed after this call. Meant for cleanup and state saving that may require other modules.

Reimplemented from RegisteredRunner.

Definition at line 323 of file pconn.cc.

References closeN(), and size_.

virtual void RegisteredRunner::finalizeConfig ( )
inlinevirtualinherited

Called after parsing squid.conf. Meant for setting configuration options that depend on other configuration options and were not explicitly configured.

Reimplemented in sslBumpCfgRr, and MemStoreRr.

Definition at line 47 of file RunnersRegistry.h.

Referenced by SquidMain().

void IdleConnList::findAndClose ( const Comm::ConnectionPointer conn)
private
int IdleConnList::findIndexOf ( const Comm::ConnectionPointer conn) const
private

Search the list. Matches by FD socket number. Performed from the end of list where newest entries are.

Return values
<0The connection is not listed
>=0The connection array index

Definition at line 72 of file pconn.cc.

References debugs, Comm::Connection::fd, HERE(), size_, and theList_.

Referenced by findAndClose().

Comm::ConnectionPointer IdleConnList::findUseable ( const Comm::ConnectionPointer key)

Search the list for a connection which matches the 'key' details and pop it off the list. The list is created based on remote IP:port hash. This further filters the choices based on specific local-end details requested. If nothing usable is found the a nil pointer is returned.

Definition at line 245 of file pconn.cc.

References assert, clearHandlers(), fd_table, i, Ip::Address::isAnyAddr(), isAvailable(), Comm::Connection::local, Ip::Address::matchIPAddr(), NULL, Ip::Address::port(), removeAt(), size_, and theList_.

Referenced by PconnPool::pop().

virtual void RegisteredRunner::finishShutdown ( )
inlinevirtualinherited

Definition at line 87 of file RunnersRegistry.h.

Referenced by RunRegistered(), SquidShutdown(), testRock::tearDown(), and watch_child().

bool IdleConnList::isAvailable ( int  i) const
private

Determine whether an entry in the idle list is available for use. Returns false if the entry is unset, closed or closing.

Definition at line 197 of file pconn.cc.

References COMMIO_FD_READCB, conn, Comm::Connection::fd, i, Comm::IsConnOpen(), and theList_.

Referenced by findUseable(), and pop().

void IdleConnList::operator delete ( void *  address)
inline

Definition at line 41 of file pconn.h.

void* IdleConnList::operator new ( size_t  size)
inline

Definition at line 41 of file pconn.h.

Comm::ConnectionPointer IdleConnList::pop ( )

Definition at line 213 of file pconn.cc.

References clearHandlers(), fd_table, i, isAvailable(), NULL, removeAt(), size_, and theList_.

void IndependentRunner::registerRunner ( )
protectedinherited

Definition at line 103 of file RunnersRegistry.cc.

References FindRunners(), and RegisterRunner_().

Referenced by ConnStateData::ConnStateData(), and IdleConnList().

bool IdleConnList::removeAt ( int  index)
private

Remove the entry at specified index. May perform a shuffle of list entries to fill the gap.

Return values
falseThe index is not an in-use entry.

Definition at line 90 of file pconn.cc.

References debugs, hashKeyStr(), PconnPool::noteConnectionRemoved(), NULL, parent_, size_, and theList_.

Referenced by findAndClose(), findUseable(), and pop().

virtual void RegisteredRunner::startReconfigure ( )
inlinevirtualinherited

Called after receiving a reconfigure request and before parsing squid.conf. Meant for modules that need to prepare for their configuration being changed [outside their control]. The changes end with the syncConfig() event.

Reimplemented in Dns::ConfigRr.

Definition at line 63 of file RunnersRegistry.h.

Referenced by mainReconfigureStart().

virtual void RegisteredRunner::startShutdown ( )
inlinevirtualinherited

Called after receiving a shutdown request and before stopping the main loop. At least one main loop iteration is guaranteed after this call. Meant for cleanup and state saving that may require other modules.

Reimplemented in ConnStateData.

Definition at line 74 of file RunnersRegistry.h.

Referenced by SignalEngine::doShutdown().

virtual void RegisteredRunner::syncConfig ( )
inlinevirtualinherited

Called after parsing squid.conf during reconfiguration. Meant for adjusting the module state based on configuration changes.

Reimplemented in PeerPoolMgrsRr, and Auth::CredentialCacheRr.

Definition at line 67 of file RunnersRegistry.h.

Referenced by mainReconfigureFinish().

void* IdleConnList::toCbdata ( )
inlinenoexcept

Definition at line 41 of file pconn.h.

void IndependentRunner::unregisterRunner ( )
protectedinherited

Definition at line 95 of file RunnersRegistry.cc.

References FindRunners().

Referenced by IndependentRunner::~IndependentRunner().

virtual void RegisteredRunner::useConfig ( )
inlinevirtualinherited

Called after claimMemoryNeeds(). Meant for activating modules and features using a finalized configuration with known memory requirements.

Reimplemented in MemStoreRr, SharedSessionCacheRr, TransientsRr, PeerPoolMgrsRr, ClientDbRr, SharedMemPagesRr, and Ipc::Mem::RegisteredRunner.

Definition at line 56 of file RunnersRegistry.h.

Referenced by StartUsingConfig().

Member Data Documentation

int IdleConnList::capacity_
private

Number of in-use entries in theList

Definition at line 85 of file pconn.h.

Referenced by IdleConnList(), and push().

cbdata_type IdleConnList::CBDATA_IdleConnList = CBDATA_UNKNOWN
staticprivate

Definition at line 41 of file pconn.h.

char IdleConnList::fakeReadBuf_[4096]
private

Definition at line 96 of file pconn.h.

Referenced by push().

void* hash_link::key
inherited

Definition at line 19 of file hash.h.

Referenced by aclMatchExternal(), MemStore::anchorCollapsed(), Rock::SwapDir::anchorCollapsed(), cacheIndexCmp(), StoreMetaMD5::checkConsistency(), StoreEntry::clearPublicKeyScope(), ClientInfo::ClientInfo(), Transients::copyFromShm(), Rock::SwapDir::createStoreIO(), CommQuotaQueue::dequeue(), destroyStoreEntry(), LeakFinder::dump(), CommQuotaQueue::enqueue(), external_acl_cache_add(), StoreEntry::forcePublicKey(), fqdncache_entry::fqdncache_entry(), fqdncacheAddEntry(), fqdncacheParse(), StoreEntry::getMD5Text(), hash_join(), hash_lookup(), hash_remove_link(), hash_unlink(), StoreEntry::hashDelete(), StoreEntry::hashInsert(), hashKeyStr(), htcpQuery(), IdleConnList(), idnsStartQuery(), ipcache_entry::ipcache_entry(), ipcacheAddEntry(), ipcacheRelease(), LeakFinderPtr::LeakFinderPtr(), Fs::Ufs::UFSSwapDir::logEntry(), my_free(), ipcache_entry::name(), neighborsUdpPing(), net_db_name::net_db_name(), netdbHashInsert(), Ipc::StoreMap::openForUpdating(), Rock::SwapDir::openStoreIO(), peerCountMcastPeersStart(), read_passwd_file(), Ipc::StoreMapAnchor::set(), StoreEntry::setPrivateKey(), StoreEntry::setPublicKey(), ClientInfo::setWriteLimiter(), Ident::Start(), MemStore::startCaching(), Transients::startWriting(), storeDigestAdd(), storeDigestDel(), storeRebuildParseEntry(), storeSwapMetaBuild(), MemStore::unlink(), UFSCleanLog::write(), ClientInfo::~ClientInfo(), ExternalACLEntry::~ExternalACLEntry(), fqdncache_entry::~fqdncache_entry(), ~IdleConnList(), and net_db_name::~net_db_name().

PconnPool* IdleConnList::parent_
private

The pool containing this sub-list. The parent performs all stats accounting, and will delete us when it dies. It persists for the full duration of our existence.

Definition at line 94 of file pconn.h.

Referenced by closeN(), findAndClose(), push(), removeAt(), and ~IdleConnList().

void IdleConnList::Read
staticprivate

Definition at line 73 of file pconn.h.

Referenced by clearHandlers(), and push().

int IdleConnList::size_
private
Comm::ConnectionPointer* IdleConnList::theList_
private

List of connections we are holding. Sorted as FIFO list for most efficient speeds on pop() and findUsable() The worst-case pop() and scans occur on timeout and link closure events where timing is less critical. Occasional slow additions are okay.

Definition at line 82 of file pconn.h.

Referenced by closeN(), findIndexOf(), findUseable(), IdleConnList(), isAvailable(), pop(), push(), removeAt(), and ~IdleConnList().

void IdleConnList::Timeout
staticprivate

Definition at line 74 of file pconn.h.

Referenced by push().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors