From: Amos Jeffries Date: Sat, 11 Sep 2010 03:33:44 +0000 (+1200) Subject: Remove redundant accept params. add costructors for subscriptions X-Git-Tag: take08~55^2~124^2~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9ddfca257cb15b3fcd71c059be98b3b3452af90;p=thirdparty%2Fsquid.git Remove redundant accept params. add costructors for subscriptions --- diff --git a/src/CommCalls.cc b/src/CommCalls.cc index fd5a14a599..de063ea07c 100644 --- a/src/CommCalls.cc +++ b/src/CommCalls.cc @@ -39,21 +39,11 @@ CommCommonCbParams::print(std::ostream &os) const /* CommAcceptCbParams */ -CommAcceptCbParams::CommAcceptCbParams(void *aData): CommCommonCbParams(aData), - nfd(-1) +CommAcceptCbParams::CommAcceptCbParams(void *aData): + CommCommonCbParams(aData) { } -void -CommAcceptCbParams::print(std::ostream &os) const -{ - CommCommonCbParams::print(os); - if (nfd >= 0) - os << ", newFD " << nfd; - if (details != NULL) - os << ", " << details; -} - /* CommConnectCbParams */ @@ -129,10 +119,16 @@ CommAcceptCbPtrFun::CommAcceptCbPtrFun(IOACB *aHandler, { } +CommAcceptCbPtrFun::CommAcceptCbPtrFun(const CommAcceptCbPtrFun &o): + CommDialerParamsT(o.params), + handler(o.handler) +{ +} + void CommAcceptCbPtrFun::dial() { - handler(params.fd, params.nfd, params.details, params.flag, params.xerrno, params.data); + handler(params.fd, params.conn, params.flag, params.xerrno, params.data); } void diff --git a/src/CommCalls.h b/src/CommCalls.h index cff7d5a5ad..e44d33caa5 100644 --- a/src/CommCalls.h +++ b/src/CommCalls.h @@ -21,7 +21,7 @@ * - I/O (IOCB). */ -typedef void IOACB(int fd, int nfd, Comm::ConnectionPointer &details, comm_err_t flag, int xerrno, void *data); +typedef void IOACB(int fd, const Comm::ConnectionPointer &details, comm_err_t flag, int xerrno, void *data); typedef void CNCB(const Comm::ConnectionPointer &conn, comm_err_t status, int xerrno, void *data); typedef void IOCB(int fd, char *, size_t size, comm_err_t flag, int xerrno, void *data); @@ -69,12 +69,6 @@ class CommAcceptCbParams: public CommCommonCbParams { public: CommAcceptCbParams(void *aData); - - void print(std::ostream &os) const; - -public: - Comm::ConnectionPointer details; - int nfd; // TODO: rename to fdNew or somesuch }; // connect parameters @@ -175,10 +169,12 @@ class CommAcceptCbPtrFun: public CallDialer, { public: typedef CommAcceptCbParams Params; + typedef RefCount Pointer; CommAcceptCbPtrFun(IOACB *aHandler, const CommAcceptCbParams &aParams); - void dial(); + CommAcceptCbPtrFun(const CommAcceptCbPtrFun &o); + void dial(); virtual void print(std::ostream &os) const; public: @@ -258,11 +254,16 @@ template class CommCbFunPtrCallT: public AsyncCall { public: + typedef RefCount > Pointer; typedef typename Dialer::Params Params; inline CommCbFunPtrCallT(int debugSection, int debugLevel, const char *callName, const Dialer &aDialer); + // parameter cannot be const because getDialer() cannot be const + // getDialer() cannot because Comm IO syncWithComm() alters the object params data + inline CommCbFunPtrCallT(Pointer &p) : dialer(*dynamic_cast(p->getDialer())) {} + virtual CallDialer* getDialer() { return &dialer; } public: