PeerPoolMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 "comm/forward.h"
14 #include "security/forward.h"
15 
16 class HttpRequest;
17 class CachePeer;
19 
21 class PeerPoolMgr: public AsyncJob
22 {
24 
25 public:
27 
28  // syncs mgr state whenever connection-related peer or pool state changes
29  static void Checkpoint(const Pointer &mgr, const char *reason);
30 
31  explicit PeerPoolMgr(CachePeer *aPeer);
32  virtual ~PeerPoolMgr();
33 
34 protected:
35  /* AsyncJob API */
36  virtual void start();
37  virtual void swanSong();
38  virtual bool doneAll() const;
39 
41  bool validPeer() const;
42 
45  void checkpoint(const char *reason);
47  void openNewConnection();
49  void closeOldConnections(const int howMany);
50 
52  void handleOpenedConnection(const CommConnectCbParams &params);
53 
56 
58  void handleSecureClosure(const CommCloseCbParams &params);
59 
62 
63 private:
69  unsigned int addrUsed;
70 };
71 
72 #endif /* SQUID_PEERPOOLMGR_H */
73 
virtual bool doneAll() const
whether positive goal has been reached
Definition: PeerPoolMgr.cc:85
PeerPoolMgr(CachePeer *aPeer)
Definition: PeerPoolMgr.cc:43
void openNewConnection()
starts the process of opening a new standby connection (if possible)
Definition: PeerPoolMgr.cc:189
AsyncCall::Pointer opener
whether we are opening a connection
Definition: PeerPoolMgr.h:66
static void Checkpoint(const Pointer &mgr, const char *reason)
Definition: PeerPoolMgr.cc:261
int conn
the current server connection FD
Definition: Transport.cc:26
virtual void start()
called by AsyncStart; do not call directly
Definition: PeerPoolMgr.cc:59
virtual ~PeerPoolMgr()
Definition: PeerPoolMgr.cc:53
AsyncCall::Pointer closer
monitors conn while we are securing it
Definition: PeerPoolMgr.h:68
bool validPeer() const
whether the peer is still out there and in a valid state we can safely use
Definition: PeerPoolMgr.cc:79
void closeOldConnections(const int howMany)
closes 'howMany' standby connections
Definition: PeerPoolMgr.cc:236
void checkpoint(const char *reason)
Definition: PeerPoolMgr.cc:243
RefCount< HttpRequest > request
fake HTTP request for conn opening code
Definition: PeerPoolMgr.h:65
void handleSecureClosure(const CommCloseCbParams &params)
called when the connection we are trying to secure is closed by a 3rd party
Definition: PeerPoolMgr.cc:177
void pushNewConnection(const Comm::ConnectionPointer &conn)
the final step in connection opening (and, optionally, securing) sequence
Definition: PeerPoolMgr.cc:136
void handleSecuredPeer(Security::EncryptorAnswer &answer)
Security::PeerConnector callback.
Definition: PeerPoolMgr.cc:145
AsyncCall::Pointer securer
whether we are securing a connection
Definition: PeerPoolMgr.h:67
unsigned int addrUsed
counter for cycling through peer addresses
Definition: PeerPoolMgr.h:69
virtual void swanSong()
Definition: PeerPoolMgr.cc:73
CachePeer * peer
the owner of the pool we manage
Definition: PeerPoolMgr.h:64
Maintains an fixed-size "standby" PconnPool for a single CachePeer.
Definition: PeerPoolMgr.h:21
void handleOpenedConnection(const CommConnectCbParams &params)
Comm::ConnOpener calls this when done opening a connection for us.
Definition: PeerPoolMgr.cc:91
CBDATA_CLASS(PeerPoolMgr)
CbcPointer< PeerPoolMgr > Pointer
Definition: PeerPoolMgr.h:26

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors