#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 () override
 
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)
 
void endingShutdown () override
 

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 bootstrapConfig ()
 
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 37 of file pconn.h.

Member Typedef Documentation

◆ Method

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

Definition at line 94 of file RunnersRegistry.h.

Constructor & Destructor Documentation

◆ IdleConnList()

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

◆ ~IdleConnList()

IdleConnList::~IdleConnList ( )
override

Definition at line 50 of file pconn.cc.

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

Member Function Documentation

◆ bootstrapConfig()

virtual void RegisteredRunner::bootstrapConfig ( )
inlinevirtualinherited

Called right before parsing squid.conf. Meant for initializing/preparing configuration parsing facilities.

Reimplemented in NtlmAuthRr.

Definition at line 46 of file RunnersRegistry.h.

Referenced by SquidMain().

◆ claimMemoryNeeds()

virtual void RegisteredRunner::claimMemoryNeeds ( )
inlinevirtualinherited

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

Reimplemented in IpcIoRr, and MemStoreRr.

Definition at line 55 of file RunnersRegistry.h.

Referenced by RunConfigUsers().

◆ clearHandlers()

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

Definition at line 160 of file pconn.cc.

References comm_read_cancel(), commUnsetConnTimeout(), conn, debugs, and Read.

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

◆ closeN()

void IdleConnList::closeN ( size_t  count)

◆ count()

int IdleConnList::count ( ) const
inline

Definition at line 61 of file pconn.h.

References size_.

Referenced by PconnPool::unlinkList().

◆ endingShutdown()

void IdleConnList::endingShutdown ( )
overridevirtual

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

◆ 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 51 of file RunnersRegistry.h.

Referenced by SquidMain().

◆ findAndClose()

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

Definition at line 284 of file pconn.cc.

References clearHandlers(), conn, findIndexOf(), PconnPool::notifyManager(), parent_, and removeAt().

◆ 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 conn, debugs, Comm::Connection::fd, size_, and theList_.

Referenced by 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, Ip::Address::isAnyAddr(), isAvailable(), Comm::Connection::local, Ip::Address::matchIPAddr(), Ip::Address::port(), removeAt(), size_, and theList_.

Referenced by PconnPool::popStored().

◆ finishShutdown()

virtual void RegisteredRunner::finishShutdown ( )
inlinevirtualinherited

Definition at line 91 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::IsConnOpen(), and theList_.

Referenced by findUseable(), and pop().

◆ operator delete()

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

Definition at line 39 of file pconn.h.

◆ operator new()

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

Definition at line 39 of file pconn.h.

◆ pop()

Comm::ConnectionPointer IdleConnList::pop ( )

Definition at line 213 of file pconn.cc.

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

◆ push()

◆ registerRunner()

void IndependentRunner::registerRunner ( )
protectedinherited

◆ 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(), parent_, size_, and theList_.

Referenced by 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 67 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, and Rock::Rebuild.

Definition at line 78 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 Auth::CredentialCacheRr, and PeerPoolMgrsRr.

Definition at line 71 of file RunnersRegistry.h.

Referenced by mainReconfigureFinish().

◆ toCbdata()

void * IdleConnList::toCbdata ( )
inlinenoexcept

Definition at line 39 of file pconn.h.

◆ unregisterRunner()

void IndependentRunner::unregisterRunner ( )
protectedinherited

Definition at line 96 of file RunnersRegistry.cc.

References FindRunners().

Referenced by IndependentRunner::~IndependentRunner().

◆ 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 ClientDbRr, SharedMemPagesRr, Ipc::Mem::RegisteredRunner, MemStoreRr, PeerPoolMgrsRr, SharedSessionCacheRr, and TransientsRr.

Definition at line 60 of file RunnersRegistry.h.

Referenced by RunConfigUsers().

Member Data Documentation

◆ capacity_

int IdleConnList::capacity_
private

Number of in-use entries in theList

Definition at line 83 of file pconn.h.

Referenced by IdleConnList(), and push().

◆ CBDATA_IdleConnList

cbdata_type IdleConnList::CBDATA_IdleConnList = CBDATA_UNKNOWN
staticprivate

Definition at line 39 of file pconn.h.

◆ fakeReadBuf_

char IdleConnList::fakeReadBuf_[4096]
private

Definition at line 94 of file pconn.h.

Referenced by push().

◆ key

void* hash_link::key
inherited

◆ 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 92 of file pconn.h.

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

◆ Read

void IdleConnList::Read
staticprivate

Definition at line 71 of file pconn.h.

Referenced by clearHandlers(), 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 80 of file pconn.h.

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

◆ Timeout

void IdleConnList::Timeout
staticprivate

Definition at line 72 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