76 for (
auto right =
size_; right > 0; --right) {
77 const auto index = right - 1;
79 debugs(48, 3,
"found " << conn <<
" at index " << index);
84 debugs(48, 2, conn <<
" NOT FOUND!");
100 for (; index <
size_ - 1; ++index)
120 debugs(48, 2,
"Nothing to do.");
122 }
else if (n >=
size_) {
123 debugs(48, 2,
"Closing all entries.");
133 debugs(48, 2,
"Closing " << n <<
" of " <<
size_ <<
" entries.");
137 for (index = 0; index < n; ++index) {
146 for (index = 0; index <
size_ - n; ++index) {
150 while (index <
size_) {
166 debugs(48, 3,
"removing close handler for " << conn);
175 debugs(48, 3,
"growing idle Connection array");
179 for (
size_t index = 0; index <
size_; ++index)
219 for (
auto right =
size_; right > 0; --right) {
220 const auto i = right - 1;
261 const bool keyCheckPort = aKey->
local.
port() > 0;
263 for (
auto right =
size_; right > 0; --right) {
264 const auto i = right - 1;
316 debugs(48, 3, len <<
" bytes from " << conn);
319 debugs(48, 3,
"Comm::ERR_CLOSING from " << conn);
358 const int used = strlen(buf);
362 debugs(48,6,
"PconnPool::key(" << destLink <<
", " << (domain?domain:
"[no domain]") <<
") is {" << buf <<
"}" );
370 " connection use histogram:\n"
371 " # requests per connection: closed connections that carried that many requests\n");
378 " " << i <<
": " <<
hist[i] <<
"\n";
385 const auto hid =
table;
387 AtMostOnce title(
" open connections list:\n");
390 " \"" <<
static_cast<char *
>(walker->key) <<
"\": " <<
399 yaml <<
"pool " <<
descr <<
":\n";
407 table(nullptr), descr(aDescr),
438 debugs(48, 3,
"Not many unused FDs");
443 debugs(48, 3,
"Squid is shutting down. Refusing to do anything");
448 const char *aKey =
key(conn, domain);
451 if (list ==
nullptr) {
463 snprintf(desc,
FD_DESC_SZ,
"Idle server: %s", aKey);
465 debugs(48, 3,
"pushed " << conn <<
" for " << aKey);
476 if (
const auto direct =
popStored(dest, domain, keepOpen))
480 if (
const auto peer = dest->
getPeer()) {
481 if (peer->standby.pool)
482 return peer->standby.pool->popStored(dest, domain,
true);
493 const char * aKey =
key(dest, domain);
496 if (list ==
nullptr) {
497 debugs(48, 3,
"lookup for key {" << aKey <<
"} failed.");
503 (keepOpen ?
" to use" :
" to kill"));
536 for (
int i = 0; i < n &&
count(); ++i) {
591 "Persistent Connection Utilization Histograms",
611 for (
const auto &p:
pools)
CommCbFunPtrCallT< Dialer > * commCbCall(int debugSection, int debugLevel, const char *callName, const Dialer &dialer)
#define COMMIO_FD_READCB(fd)
void comm_read_cancel(int fd, IOCB *callback, void *data)
void comm_read(const Comm::ConnectionPointer &conn, char *buf, int len, AsyncCall::Pointer &callback)
#define CBDATA_CLASS_INIT(type)
Cbc * valid() const
was set and is valid
Comm::ConnectionPointer conn
time_t timeLeft(const time_t idleTimeout) const
CachePeer * getPeer() const
IdleConnList(const char *key, PconnPool *parent)
void findAndClose(const Comm::ConnectionPointer &conn)
Comm::ConnectionPointer pop()
get first conn which is not pending read fd.
void clearHandlers(const Comm::ConnectionPointer &conn)
bool isAvailable(int i) const
int findIndexOf(const Comm::ConnectionPointer &conn) const
Comm::ConnectionPointer findUseable(const Comm::ConnectionPointer &key)
Comm::ConnectionPointer * theList_
void closeN(size_t count)
void endingShutdown() override
void push(const Comm::ConnectionPointer &conn)
Pass control of the connection to the idle list.
bool removeAt(size_t index)
size_t capacity_
Number of entries theList can currently hold without re-allocating (capacity).
int matchIPAddr(const Address &rhs) const
char * toUrl(char *buf, unsigned int len) const
unsigned short port() const
void remove(PconnPool *)
unregister and forget about this pool object
Pools pools
all live pools
static PconnModule * instance
void registerWithCacheManager(void)
void dump(std::ostream &yaml)
static PconnModule * GetInstance()
static void DumpWrapper(StoreEntry *e)
void closeN(int n)
closes any n connections, regardless of their destination
void dumpHist(std::ostream &) const
PconnPool(const char *aDescription, const CbcPointer< PeerPoolMgr > &aMgr)
void notifyManager(const char *reason)
void unlinkList(IdleConnList *list)
void noteConnectionAdded()
void dump(std::ostream &) const
Comm::ConnectionPointer popStored(const Comm::ConnectionPointer &dest, const char *domain, const bool keepOpen)
CbcPointer< PeerPoolMgr > mgr
optional pool manager (for notifications)
static const char * key(const Comm::ConnectionPointer &destLink, const char *domain)
void dumpHash(std::ostream &) const
void noteConnectionRemoved()
void push(const Comm::ConnectionPointer &serverConn, const char *domain)
Comm::ConnectionPointer pop(const Comm::ConnectionPointer &dest, const char *domain, bool keepOpen)
int theCount
the number of pooled connections
static void Checkpoint(const Pointer &mgr, const char *reason)
struct SquidConfig::@77 Timeout
void commUnsetConnTimeout(const Comm::ConnectionPointer &conn)
void commSetConnTimeout(const Comm::ConnectionPointer &conn, time_t timeout, AsyncCall::Pointer &callback)
bool comm_has_incomplete_write(int fd)
#define debugs(SECTION, LEVEL, CONTENT)
void fd_note(int fd, const char *s)
void hashFreeMemory(hash_table *)
void hashFreeItems(hash_table *, HASHFREE *)
hash_link * hash_lookup(hash_table *, const void *)
hash_table * hash_create(HASHCMP *, int, HASHHASH *)
int HASHCMP(const void *, const void *)
hash_link * hash_next(hash_table *)
void hash_first(hash_table *)
void hash_join(hash_table *, hash_link *)
void hash_remove_link(hash_table *, hash_link *)
const char * hashKeyStr(const hash_link *)
RefCount< Comm::Connection > ConnectionPointer
bool IsConnOpen(const Comm::ConnectionPointer &conn)
void RegisterAction(char const *action, char const *desc, OBJH *handler, Protected, Atomic, Format)
static void DeleteIdleConnList(void *hashItem)
#define LOCAL_ARRAY(type, name, size)