]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/CommCalls.cc
5 /* CommCommonCbParams */
7 CommCommonCbParams::CommCommonCbParams(void *aData
):
8 data(cbdataReference(aData
)), fd(-1), xerrno(0), flag(COMM_OK
)
12 CommCommonCbParams::CommCommonCbParams(const CommCommonCbParams
&p
):
13 data(cbdataReference(p
.data
)), fd(p
.fd
), xerrno(p
.xerrno
), flag(p
.flag
)
17 CommCommonCbParams::~CommCommonCbParams()
19 cbdataReferenceDone(data
);
23 CommCommonCbParams::print(std::ostream
&os
) const
27 os
<< ", errno=" << xerrno
;
29 os
<< ", flag=" << flag
;
31 os
<< ", data=" << data
;
35 /* CommAcceptCbParams */
37 CommAcceptCbParams::CommAcceptCbParams(void *aData
): CommCommonCbParams(aData
),
43 CommAcceptCbParams::print(std::ostream
&os
) const
45 CommCommonCbParams::print(os
);
47 os
<< ", newFD " << nfd
;
51 /* CommConnectCbParams */
53 CommConnectCbParams::CommConnectCbParams(void *aData
):
54 CommCommonCbParams(aData
)
59 CommConnectCbParams::syncWithComm()
61 // drop the call if the call was scheduled before comm_close but
62 // is being fired after comm_close
63 if (fd
>= 0 && fd_table
[fd
].closing()) {
64 debugs(5, 3, HERE
<< "droppin late connect call: FD " << fd
);
67 return true; // now we are in sync and can handle the call
72 CommIoCbParams::CommIoCbParams(void *aData
): CommCommonCbParams(aData
),
78 CommIoCbParams::syncWithComm()
80 // change parameters if the call was scheduled before comm_close but
81 // is being fired after comm_close
82 if (fd
>= 0 && fd_table
[fd
].closing() && flag
!= COMM_ERR_CLOSING
) {
83 debugs(5, 3, HERE
<< "converting late call to COMM_ERR_CLOSING: FD " << fd
);
84 flag
= COMM_ERR_CLOSING
;
87 return true; // now we are in sync and can handle the call
92 CommIoCbParams::print(std::ostream
&os
) const
94 CommCommonCbParams::print(os
);
96 os
<< ", size=" << size
;
97 os
<< ", buf=" << (void*)buf
;
102 /* CommCloseCbParams */
104 CommCloseCbParams::CommCloseCbParams(void *aData
):
105 CommCommonCbParams(aData
)
109 /* CommTimeoutCbParams */
111 CommTimeoutCbParams::CommTimeoutCbParams(void *aData
):
112 CommCommonCbParams(aData
)
117 /* CommAcceptCbPtrFun */
119 CommAcceptCbPtrFun::CommAcceptCbPtrFun(IOACB
*aHandler
,
120 const CommAcceptCbParams
&aParams
):
121 CommDialerParamsT
<CommAcceptCbParams
>(aParams
),
127 CommAcceptCbPtrFun::dial()
129 handler(params
.fd
, params
.nfd
, ¶ms
.details
, params
.flag
, params
.xerrno
, params
.data
);
133 CommAcceptCbPtrFun::print(std::ostream
&os
) const
141 /* CommConnectCbPtrFun */
143 CommConnectCbPtrFun::CommConnectCbPtrFun(CNCB
*aHandler
,
144 const CommConnectCbParams
&aParams
):
145 CommDialerParamsT
<CommConnectCbParams
>(aParams
),
151 CommConnectCbPtrFun::dial()
153 handler(params
.fd
, params
.flag
, params
.xerrno
, params
.data
);
157 CommConnectCbPtrFun::print(std::ostream
&os
) const
167 CommIoCbPtrFun::CommIoCbPtrFun(IOCB
*aHandler
, const CommIoCbParams
&aParams
):
168 CommDialerParamsT
<CommIoCbParams
>(aParams
),
174 CommIoCbPtrFun::dial()
176 handler(params
.fd
, params
.buf
, params
.size
, params
.flag
, params
.xerrno
, params
.data
);
180 CommIoCbPtrFun::print(std::ostream
&os
) const
188 /* CommCloseCbPtrFun */
190 CommCloseCbPtrFun::CommCloseCbPtrFun(PF
*aHandler
,
191 const CommCloseCbParams
&aParams
):
192 CommDialerParamsT
<CommCloseCbParams
>(aParams
),
198 CommCloseCbPtrFun::dial()
200 handler(params
.fd
, params
.data
);
204 CommCloseCbPtrFun::print(std::ostream
&os
) const
211 /* CommTimeoutCbPtrFun */
213 CommTimeoutCbPtrFun::CommTimeoutCbPtrFun(PF
*aHandler
,
214 const CommTimeoutCbParams
&aParams
):
215 CommDialerParamsT
<CommTimeoutCbParams
>(aParams
),
221 CommTimeoutCbPtrFun::dial()
223 handler(params
.fd
, params
.data
);
227 CommTimeoutCbPtrFun::print(std::ostream
&os
) const