]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/comm/ConnOpener.h
1 #ifndef _SQUID_SRC_COMM_OPENERSTATEDATA_H
2 #define _SQUID_SRC_COMM_OPENERSTATEDATA_H
4 #include "base/AsyncCall.h"
5 #include "base/AsyncJob.h"
8 #include "comm/comm_err_t.h"
9 #include "comm/forward.h"
14 * Async-opener of a Comm connection.
16 class ConnOpener
: public AsyncJob
20 virtual void swanSong();
23 virtual bool doneAll() const;
25 ConnOpener(Comm::ConnectionPointer
&, AsyncCall::Pointer
&handler
, time_t connect_timeout
);
28 void setHost(const char *); ///< set the hostname note for this connection
29 const char * getHost() const; ///< get the hostname noted for this connection
32 // Undefined because two openers cannot share a connection
33 ConnOpener(const ConnOpener
&);
34 ConnOpener
& operator =(const ConnOpener
&c
);
36 void earlyAbort(const CommConnectCbParams
&);
37 void timeout(const CommTimeoutCbParams
&);
38 void doneConnecting(comm_err_t status
, int xerrno
);
39 static void InProgressConnectRetry(int fd
, void *data
);
40 static void DelayedConnectRetry(void *data
);
43 void lookupLocalAddress();
46 char *host_
; ///< domain name we are trying to connect to.
47 Comm::ConnectionPointer conn_
; ///< single connection currently being opened.
48 AsyncCall::Pointer callback_
; ///< handler to be called on connection completion.
50 int totalTries_
; ///< total number of connection attempts over all destinations so far.
51 int failRetries_
; ///< number of retries current destination has been tried.
54 * time at which to abandon the connection.
55 * the connection-done callback will be passed COMM_TIMEOUT
57 time_t connectTimeout_
;
59 /// time at which this series of connection attempts was started.
62 /// handles to calls which we may need to cancel.
64 AsyncCall::Pointer earlyAbort_
;
65 AsyncCall::Pointer timeout_
;
68 CBDATA_CLASS2(ConnOpener
);
73 #endif /* _SQUID_SRC_COMM_CONNOPENER_H */