PeerPoolMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2021 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_PEERPOOLMGR_H
10 #define SQUID_PEERPOOLMGR_H
11 
12 #include "base/AsyncJob.h"
13 #include "base/JobWait.h"
14 #include "comm/forward.h"
15 #include "security/forward.h"
16 
17 class HttpRequest;
18 class CachePeer;
20 
22 class PeerPoolMgr: public AsyncJob
23 {
25 
26 public:
28 
29  // syncs mgr state whenever connection-related peer or pool state changes
30  static void Checkpoint(const Pointer &mgr, const char *reason);
31 
32  explicit PeerPoolMgr(CachePeer *aPeer);
33  virtual ~PeerPoolMgr();
34 
35 protected:
36  /* AsyncJob API */
37  virtual void start();
38  virtual void swanSong();
39  virtual bool doneAll() const;
40 
42  bool validPeer() const;
43 
46  void checkpoint(const char *reason);
48  void openNewConnection();
50  void closeOldConnections(const int howMany);
51 
53  void handleOpenedConnection(const CommConnectCbParams &params);
54 
57 
60 
61 private:
64 
67 
70 
71  unsigned int addrUsed;
72 };
73 
74 #endif /* SQUID_PEERPOOLMGR_H */
75 
void handleSecuredPeer(Security::EncryptorAnswer &answer)
Security::PeerConnector callback.
Definition: PeerPoolMgr.cc:137
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:69
void handleOpenedConnection(const CommConnectCbParams &params)
Comm::ConnOpener calls this when done opening a connection for us.
Definition: PeerPoolMgr.cc:90
JobWait< Comm::ConnOpener > transportWait
waits for a transport connection to the peer to be established/opened
Definition: PeerPoolMgr.h:66
virtual void swanSong()
Definition: PeerPoolMgr.cc:72
CachePeer * peer
the owner of the pool we manage
Definition: PeerPoolMgr.h:62
CbcPointer< PeerPoolMgr > Pointer
Definition: PeerPoolMgr.h:27
CBDATA_CLASS(PeerPoolMgr)
unsigned int addrUsed
counter for cycling through peer addresses
Definition: PeerPoolMgr.h:71
bool validPeer() const
whether the peer is still out there and in a valid state we can safely use
Definition: PeerPoolMgr.cc:78
int conn
the current server connection FD
Definition: Transport.cc:26
void openNewConnection()
starts the process of opening a new standby connection (if possible)
Definition: PeerPoolMgr.cc:170
PeerPoolMgr(CachePeer *aPeer)
Definition: PeerPoolMgr.cc:43
void checkpoint(const char *reason)
Definition: PeerPoolMgr.cc:224
virtual void start()
called by AsyncStart; do not call directly
Definition: PeerPoolMgr.cc:58
virtual ~PeerPoolMgr()
Definition: PeerPoolMgr.cc:52
void pushNewConnection(const Comm::ConnectionPointer &conn)
the final step in connection opening (and, optionally, securing) sequence
Definition: PeerPoolMgr.cc:128
static void Checkpoint(const Pointer &mgr, const char *reason)
Definition: PeerPoolMgr.cc:242
virtual bool doneAll() const
whether positive goal has been reached
Definition: PeerPoolMgr.cc:84
void closeOldConnections(const int howMany)
closes 'howMany' standby connections
Definition: PeerPoolMgr.cc:217
RefCount< HttpRequest > request
fake HTTP request for conn opening code
Definition: PeerPoolMgr.h:63

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors