From: Amos Jeffries Date: Thu, 23 Sep 2010 15:32:37 +0000 (+1200) Subject: audit and I/O transition call bits X-Git-Tag: take08~55^2~124^2~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a138c8fc988d27996e255c37eadca0fed2009c94;p=thirdparty%2Fsquid.git audit and I/O transition call bits --- diff --git a/src/CommCalls.cc b/src/CommCalls.cc index de063ea07c..fadad9b4b8 100644 --- a/src/CommCalls.cc +++ b/src/CommCalls.cc @@ -74,10 +74,18 @@ CommIoCbParams::CommIoCbParams(void *aData): CommCommonCbParams(aData), bool CommIoCbParams::syncWithComm() { + // transition only: read/write legacy code does not know about conn, it just sets FD + if (fd >= 0) { + if (conn == NULL) + conn = new Comm::Connection; + if (conn->fd != fd) + conn->fd = fd; + } + // change parameters if the call was scheduled before comm_close but // is being fired after comm_close - if (fd >= 0 && fd_table[fd].closing() && flag != COMM_ERR_CLOSING) { - debugs(5, 3, HERE << "converting late call to COMM_ERR_CLOSING: FD " << fd); + if (conn->fd >= 0 && fd_table[conn->fd].closing() && flag != COMM_ERR_CLOSING) { + debugs(5, 3, HERE << "converting late call to COMM_ERR_CLOSING: " << conn); flag = COMM_ERR_CLOSING; size = 0; } @@ -175,7 +183,7 @@ CommIoCbPtrFun::CommIoCbPtrFun(IOCB *aHandler, const CommIoCbParams &aParams): void CommIoCbPtrFun::dial() { - handler(params.fd, params.buf, params.size, params.flag, params.xerrno, params.data); + handler(params.conn, params.buf, params.size, params.flag, params.xerrno, params.data); } void diff --git a/src/CommCalls.h b/src/CommCalls.h index f258d34c2d..07303f1817 100644 --- a/src/CommCalls.h +++ b/src/CommCalls.h @@ -23,7 +23,7 @@ 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); +typedef void IOCB(const Comm::ConnectionPointer &conn, char *, size_t size, comm_err_t flag, int xerrno, void *data); /* * TODO: When there are no function-pointer-based callbacks left, all @@ -260,6 +260,7 @@ public: inline CommCbFunPtrCallT(int debugSection, int debugLevel, const char *callName, const Dialer &aDialer); +// XXX: obsolete comment? // parameter cannot be const because getDialer() cannot be const // getDialer() cannot because Comm IO syncWithComm() alters the object params data inline CommCbFunPtrCallT(const Pointer &p) : diff --git a/src/base/Subscription.h b/src/base/Subscription.h index d1d559595e..326e04769d 100644 --- a/src/base/Subscription.h +++ b/src/base/Subscription.h @@ -36,6 +36,7 @@ class CallSubscription: public Subscription public: CallSubscription(const RefCount &aCall) : call(aCall) {}; +// XXX: obsolete comment? // cant be const sometimes because CommCbFunPtrCallT cant provide a const overload. // CommCbFunPtrCallT lists why. boils down to Comm IO syncWithComm() existence // NP: we still treat it as const though.