Squid Web Cache master
Loading...
Searching...
No Matches
PeerPoolMgr.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#ifndef SQUID_SRC_PEERPOOLMGR_H
10#define SQUID_SRC_PEERPOOLMGR_H
11
12#include "base/AsyncJob.h"
13#include "base/forward.h"
14#include "base/JobWait.h"
15#include "comm/forward.h"
16#include "security/forward.h"
17
18class HttpRequest;
19class CachePeer;
21
23class PeerPoolMgr: public AsyncJob
24{
26
27public:
29
30 // syncs mgr state whenever connection-related peer or pool state changes
31 static void Checkpoint(const Pointer &mgr, const char *reason);
32
33 explicit PeerPoolMgr(CachePeer *aPeer);
34 ~PeerPoolMgr() override;
35
37
38protected:
39 /* AsyncJob API */
40 void start() override;
41 void swanSong() override;
42 bool doneAll() const override;
43
45 bool validPeer() const;
46
49 void checkpoint(const char *reason);
51 void openNewConnection();
53 void closeOldConnections(const int howMany);
54
57
60
63
64private:
67
70
73
74 unsigned int addrUsed;
75};
76
77#endif /* SQUID_SRC_PEERPOOLMGR_H */
78
Maintains an fixed-size "standby" PconnPool for a single CachePeer.
Definition PeerPoolMgr.h:24
JobWait< Security::BlindPeerConnector > encryptionWait
waits for the established transport connection to be secured/encrypted
Definition PeerPoolMgr.h:72
void checkpoint(const char *reason)
CBDATA_CHILD(PeerPoolMgr)
void handleSecuredPeer(Security::EncryptorAnswer &answer)
Security::PeerConnector callback.
unsigned int addrUsed
counter for cycling through peer addresses
Definition PeerPoolMgr.h:74
void openNewConnection()
starts the process of opening a new standby connection (if possible)
void swanSong() override
void start() override
called by AsyncStart; do not call directly
PrecomputedCodeContextPointer codeContext
Definition PeerPoolMgr.h:36
~PeerPoolMgr() override
RefCount< HttpRequest > request
fake HTTP request for conn opening code
Definition PeerPoolMgr.h:66
void handleOpenedConnection(const CommConnectCbParams &params)
Comm::ConnOpener calls this when done opening a connection for us.
void closeOldConnections(const int howMany)
closes 'howMany' standby connections
static void Checkpoint(const Pointer &mgr, const char *reason)
bool doneAll() const override
whether positive goal has been reached
CbcPointer< PeerPoolMgr > Pointer
Definition PeerPoolMgr.h:28
CachePeer * peer
the owner of the pool we manage
Definition PeerPoolMgr.h:65
JobWait< Comm::ConnOpener > transportWait
waits for a transport connection to the peer to be established/opened
Definition PeerPoolMgr.h:69
void pushNewConnection(const Comm::ConnectionPointer &conn)
the final step in connection opening (and, optionally, securing) sequence
bool validPeer() const
whether the peer is still out there and in a valid state we can safely use