]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/client_side_reply.cc
Merge from trunk
[thirdparty/squid.git] / src / client_side_reply.cc
index 14d5860f5d1d49bcf8da2e616394b9cabd56a1a6..e9a1540e2d8b8857904a5f41aac98e159ca8ab8c 100644 (file)
@@ -267,11 +267,10 @@ clientReplyContext::processExpired()
      * A refcounted pointer so that FwdState stays around as long as
      * this clientReplyContext does
      */
-    FwdState::fwdStart(http->getConn() != NULL ? http->getConn()->fd : -1,
-                       http->storeEntry(),
-                       http->request);
-    /* Register with storage manager to receive updates when data comes in. */
+    Comm::ConnectionPointer conn = http->getConn() != NULL ? http->getConn()->clientConn : NULL;
+    FwdState::fwdStart(conn, http->storeEntry(), http->request);
 
+    /* Register with storage manager to receive updates when data comes in. */
     if (EBIT_TEST(entry->flags, ENTRY_ABORTED))
         debugs(88, 0, "clientReplyContext::processExpired: Found ENTRY_ABORTED object");
 
@@ -687,9 +686,8 @@ clientReplyContext::processMiss()
         r->clientConnection = http->getConn();
 
         /** Start forwarding to get the new object from network */
-        FwdState::fwdStart(http->getConn() != NULL ? http->getConn()->fd : -1,
-                           http->storeEntry(),
-                           r);
+        Comm::ConnectionPointer conn = http->getConn() != NULL ? http->getConn()->clientConn : NULL;
+        FwdState::fwdStart(conn, http->storeEntry(), r);
     }
 }
 
@@ -1959,10 +1957,11 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
 
     ConnStateData * conn = http->getConn();
 
-    int fd = conn != NULL ? conn->fd : -1;
-    if (fd >= 0 && fd_table[fd].closing()) { // too late, our conn is closing
-        // TODO: should we also quit when fd is negative?
-        debugs(33,3, HERE << "not sending more data to a closing FD " << fd);
+    // AYJ: this seems a bit weird to ignore CLOSED but drop on closing.
+    if (conn != NULL && Comm::IsConnOpen(conn->clientConn) && fd_table[conn->clientConn->fd].closing()) {
+        // too late, our conn is closing
+        // TODO: should we also quit?
+        debugs(33,3, HERE << "not sending more data to a closing " << conn->clientConn);
         return;
     }
 
@@ -1978,12 +1977,12 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
     }
 
     if (reqofs==0 && !logTypeIsATcpHit(http->logType)) {
-        assert(fd >= 0); // the beginning of this method implies fd may be -1
+        assert(conn != NULL && Comm::IsConnOpen(conn->clientConn)); // the beginning of this method implies FD may be closed.
         if (Ip::Qos::TheConfig.isHitTosActive()) {
-            Ip::Qos::doTosLocalMiss(fd, http->request->hier.code);
+            Ip::Qos::doTosLocalMiss(conn->clientConn, http->request->hier.code);
         }
         if (Ip::Qos::TheConfig.isHitNfmarkActive()) {
-            Ip::Qos::doNfmarkLocalMiss(fd, http->request->hier.code);
+            Ip::Qos::doNfmarkLocalMiss(conn->clientConn, http->request->hier.code);
         }
     }
 
@@ -2006,7 +2005,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
            reqofs << " bytes (" << result.length <<
            " new bytes)");
     debugs(88, 5, "clientReplyContext::sendMoreData:"
-           " FD " << fd <<
+           << conn->clientConn <<
            " '" << entry->url() << "'" <<
            " out.offset=" << http->out.offset);
 
@@ -2042,8 +2041,6 @@ clientReplyContext::sendMoreData (StoreIOBuffer result)
     return;
 }
 
-
-
 /* Using this breaks the client layering just a little!
  */
 void