#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

◆ Method

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

Definition at line 90 of file RunnersRegistry.h.

Constructor & Destructor Documentation

◆ IdleConnList()

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

◆ ~IdleConnList()

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

◆ claimMemoryNeeds()

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().

◆ clearHandlers()

void IdleConnList::clearHandlers ( const Comm::ConnectionPointer conn)

◆ closeN()

◆ count()

◆ endingShutdown()

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_.

Referenced by count().

◆ finalizeConfig()

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().

◆ findAndClose()

◆ findIndexOf()

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 count(), and findAndClose().

◆ findUseable()

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().

◆ finishShutdown()

virtual void RegisteredRunner::finishShutdown ( )
inlinevirtualinherited

Definition at line 87 of file RunnersRegistry.h.

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

◆ isAvailable()

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 count(), findUseable(), and pop().

◆ operator delete()

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

Definition at line 41 of file pconn.h.

◆ operator new()

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

Definition at line 41 of file pconn.h.

◆ pop()

Comm::ConnectionPointer IdleConnList::pop ( )

◆ push()

◆ registerRunner()

void IndependentRunner::registerRunner ( )
protectedinherited

Definition at line 104 of file RunnersRegistry.cc.

References FindRunners(), and RegisterRunner_().

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

◆ removeAt()

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 count(), findAndClose(), findUseable(), and pop().

◆ startReconfigure()

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().

◆ startShutdown()

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().

◆ syncConfig()

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().

◆ toCbdata()

void* IdleConnList::toCbdata ( )
inlinenoexcept

Definition at line 41 of file pconn.h.

◆ unregisterRunner()

void IndependentRunner::unregisterRunner ( )
protectedinherited

Definition at line 96 of file RunnersRegistry.cc.

References FindRunners().

◆ useConfig()

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

◆ capacity_

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_IdleConnList

cbdata_type IdleConnList::CBDATA_IdleConnList = CBDATA_UNKNOWN
staticprivate

Definition at line 41 of file pconn.h.

◆ fakeReadBuf_

char IdleConnList::fakeReadBuf_[4096]
private

Definition at line 96 of file pconn.h.

Referenced by push().

◆ key

void* hash_link::key
inherited

Definition at line 19 of file hash.h.

Referenced by accessLogInit(), aclMatchExternal(), MemStore::anchorToCache(), Rock::SwapDir::anchorToCache(), cacheIndexCmp(), StoreMetaMD5::checkConsistency(), StoreEntry::clearPublicKeyScope(), client_entry(), clientdbCutoffDenied(), clientdbEstablished(), clientdbGetInfo(), clientdbUpdate(), ClientInfo::ClientInfo(), Rock::SwapDir::createStoreIO(), CommQuotaQueue::dequeue(), destroyStoreEntry(), LeakFinder::dump(), CommQuotaQueue::enqueue(), external_acl_cache_add(), StoreEntry::forcePublicKey(), fqdncache_entry::fqdncache_entry(), fqdncacheAddEntry(), fqdncacheParse(), hash_join(), hash_lookup(), hash_remove_link(), hash_unlink(), StoreEntry::hashDelete(), hashFreeMemory(), StoreEntry::hashInsert(), hashKeyStr(), Rock::SwapDir::hasReadableEntry(), htcpQuery(), IdleConnList(), idnsCallback(), idnsStartQuery(), ipcache_entry::ipcache_entry(), ipcacheAddEntry(), ipcacheRelease(), LeakFinderPtr::LeakFinderPtr(), Fs::Ufs::UFSSwapDir::logEntry(), Store::Controller::markedForDeletionAndAbandoned(), my_free(), ipcache_entry::name(), neighborsUdpPing(), net_db_name::net_db_name(), netdbHashInsert(), netdbLookupAddr(), PconnPool::noteConnectionRemoved(), Ipc::StoreMap::openForUpdating(), Rock::SwapDir::openStoreIO(), peerCountMcastPeersStart(), StoreEntry::publicKey(), read_passwd_file(), Ipc::StoreMapAnchor::set(), StoreEntry::setPrivateKey(), StoreEntry::setPublicKey(), ClientInfo::setWriteLimiter(), snmp_meshCtblFn(), Ident::Start(), MemStore::startCaching(), storeDigestAdd(), storeDigestDel(), storeKeyPrivate(), storeRebuildParseEntry(), storeSwapMetaBuild(), UFSCleanLog::write(), Rock::IoState::writeBufToDisk(), ClientInfo::~ClientInfo(), ExternalACLEntry::~ExternalACLEntry(), fqdncache_entry::~fqdncache_entry(), ~IdleConnList(), ipcache_entry::~ipcache_entry(), and net_db_name::~net_db_name().

◆ next

◆ parent_

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().

◆ Read

void IdleConnList::Read
staticprivate

Definition at line 73 of file pconn.h.

Referenced by clearHandlers(), findAndClose(), and push().

◆ size_

int IdleConnList::size_
private

◆ theList_

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().

◆ Timeout

void IdleConnList::Timeout
staticprivate

Definition at line 74 of file pconn.h.

Referenced by findAndClose(), and push().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors