]>
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
71 CommConnectCbParams::print(std::ostream
&os
) const
73 CommCommonCbParams::print(os
);
78 CommIoCbParams::CommIoCbParams(void *aData
): CommCommonCbParams(aData
),
84 CommIoCbParams::syncWithComm()
86 // change parameters if the call was scheduled before comm_close but
87 // is being fired after comm_close
88 if (fd
>= 0 && fd_table
[fd
].closing() && flag
!= COMM_ERR_CLOSING
) {
89 debugs(5, 3, HERE
<< "converting late call to COMM_ERR_CLOSING: FD " << fd
);
90 flag
= COMM_ERR_CLOSING
;
93 return true; // now we are in sync and can handle the call
98 CommIoCbParams::print(std::ostream
&os
) const
100 CommCommonCbParams::print(os
);
102 os
<< ", size=" << size
;
103 os
<< ", buf=" << (void*)buf
;
108 /* CommCloseCbParams */
110 CommCloseCbParams::CommCloseCbParams(void *aData
):
111 CommCommonCbParams(aData
)
115 /* CommTimeoutCbParams */
117 CommTimeoutCbParams::CommTimeoutCbParams(void *aData
):
118 CommCommonCbParams(aData
)
123 /* CommAcceptCbPtrFun */
125 CommAcceptCbPtrFun::CommAcceptCbPtrFun(IOACB
*aHandler
,
126 const CommAcceptCbParams
&aParams
):
127 CommDialerParamsT
<CommAcceptCbParams
>(aParams
),
133 CommAcceptCbPtrFun::dial()
135 handler(params
.fd
, params
.nfd
, params
.details
, params
.flag
, params
.xerrno
, params
.data
);
139 CommAcceptCbPtrFun::print(std::ostream
&os
) const
147 /* CommConnectCbPtrFun */
149 CommConnectCbPtrFun::CommConnectCbPtrFun(CNCB
*aHandler
,
150 const CommConnectCbParams
&aParams
):
151 CommDialerParamsT
<CommConnectCbParams
>(aParams
),
157 CommConnectCbPtrFun::dial()
159 handler(params
.conn
, params
.paths
, params
.flag
, params
.xerrno
, params
.data
);
163 CommConnectCbPtrFun::print(std::ostream
&os
) const
173 CommIoCbPtrFun::CommIoCbPtrFun(IOCB
*aHandler
, const CommIoCbParams
&aParams
):
174 CommDialerParamsT
<CommIoCbParams
>(aParams
),
180 CommIoCbPtrFun::dial()
182 handler(params
.fd
, params
.buf
, params
.size
, params
.flag
, params
.xerrno
, params
.data
);
186 CommIoCbPtrFun::print(std::ostream
&os
) const
194 /* CommCloseCbPtrFun */
196 CommCloseCbPtrFun::CommCloseCbPtrFun(PF
*aHandler
,
197 const CommCloseCbParams
&aParams
):
198 CommDialerParamsT
<CommCloseCbParams
>(aParams
),
204 CommCloseCbPtrFun::dial()
206 handler(params
.fd
, params
.data
);
210 CommCloseCbPtrFun::print(std::ostream
&os
) const
217 /* CommTimeoutCbPtrFun */
219 CommTimeoutCbPtrFun::CommTimeoutCbPtrFun(PF
*aHandler
,
220 const CommTimeoutCbParams
&aParams
):
221 CommDialerParamsT
<CommTimeoutCbParams
>(aParams
),
227 CommTimeoutCbPtrFun::dial()
229 handler(params
.fd
, params
.data
);
233 CommTimeoutCbPtrFun::print(std::ostream
&os
) const