PeerPoolMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 
18 class HttpRequest;
19 class CachePeer;
21 
23 class PeerPoolMgr: public AsyncJob
24 {
26 
27 public:
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 
38 protected:
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 
56  void handleOpenedConnection(const CommConnectCbParams &params);
57 
60 
63 
64 private:
67 
70 
73 
74  unsigned int addrUsed;
75 };
76 
77 #endif /* SQUID_SRC_PEERPOOLMGR_H */
78 
void handleSecuredPeer(Security::EncryptorAnswer &answer)
Security::PeerConnector callback.
Definition: PeerPoolMgr.cc:127
Maintains an fixed-size "standby" PconnPool for a single CachePeer.
Definition: PeerPoolMgr.h:23
JobWait< Security::BlindPeerConnector > encryptionWait
waits for the established transport connection to be secured/encrypted
Definition: PeerPoolMgr.h:72
void handleOpenedConnection(const CommConnectCbParams &params)
Comm::ConnOpener calls this when done opening a connection for us.
Definition: PeerPoolMgr.cc:81
JobWait< Comm::ConnOpener > transportWait
waits for a transport connection to the peer to be established/opened
Definition: PeerPoolMgr.h:69
CachePeer * peer
the owner of the pool we manage
Definition: PeerPoolMgr.h:65
CbcPointer< PeerPoolMgr > Pointer
Definition: PeerPoolMgr.h:28
unsigned int addrUsed
counter for cycling through peer addresses
Definition: PeerPoolMgr.h:74
bool validPeer() const
whether the peer is still out there and in a valid state we can safely use
Definition: PeerPoolMgr.cc:69
void start() override
called by AsyncStart; do not call directly
Definition: PeerPoolMgr.cc:56
~PeerPoolMgr() override
Definition: PeerPoolMgr.cc:50
PrecomputedCodeContextPointer codeContext
Definition: PeerPoolMgr.h:36
void swanSong() override
Definition: PeerPoolMgr.cc:63
void openNewConnection()
starts the process of opening a new standby connection (if possible)
Definition: PeerPoolMgr.cc:160
bool doneAll() const override
whether positive goal has been reached
Definition: PeerPoolMgr.cc:75
PeerPoolMgr(CachePeer *aPeer)
Definition: PeerPoolMgr.cc:33
void checkpoint(const char *reason)
Definition: PeerPoolMgr.cc:214
CBDATA_CHILD(PeerPoolMgr)
void pushNewConnection(const Comm::ConnectionPointer &conn)
the final step in connection opening (and, optionally, securing) sequence
Definition: PeerPoolMgr.cc:118
static void Checkpoint(const Pointer &mgr, const char *reason)
Definition: PeerPoolMgr.cc:232
void closeOldConnections(const int howMany)
closes 'howMany' standby connections
Definition: PeerPoolMgr.cc:207
RefCount< HttpRequest > request
fake HTTP request for conn opening code
Definition: PeerPoolMgr.h:66

 

Introduction

Documentation

Support

Miscellaneous