]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
audit and I/O transition call bits
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 23 Sep 2010 15:32:37 +0000 (03:32 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 23 Sep 2010 15:32:37 +0000 (03:32 +1200)
src/CommCalls.cc
src/CommCalls.h
src/base/Subscription.h

index de063ea07cfcbe3b401795e0effb2f944f5950e7..fadad9b4b8863d5dab62b97e52052fac4d36e38c 100644 (file)
@@ -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
index f258d34c2db4bfed7277569b95fc38f4ed5e9329..07303f181717c37e3f234dab850bab191ba97a2e 100644 (file)
@@ -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) :
index d1d559595e736229576527afd1866640a751da14..326e04769d152426c38afa7911e0f7c9f52a8d67 100644 (file)
@@ -36,6 +36,7 @@ class CallSubscription: public Subscription
 public:
     CallSubscription(const RefCount<Call_> &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.