]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Alex Rousskov <rousskov@measurement-factory.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 21 Dec 2010 00:53:56 +0000 (17:53 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 21 Dec 2010 00:53:56 +0000 (17:53 -0700)
Avoid comm_read "!fd_table[fd].closing()" assertion after adaptation ACL check

The assertion was hit if Server fd was closed while we were checking
adaptation ACLs, and we have not been notified of the closure yet (because the
Adaptation::AccessCheck callback is not async while closure notification is).

src/http.cc

index 0b92260247fadb80e2b4c7994df0a887b451129e..646dd728f3de5e42eaf86e17b96e1e12c612d796 100644 (file)
@@ -970,6 +970,13 @@ HttpStateData::persistentConnStatus() const
     if (eof) // already reached EOF
         return COMPLETE_NONPERSISTENT_MSG;
 
+    /* If server fd is closing (but we have not been notified yet), stop Comm
+       I/O to avoid assertions. TODO: Change Comm API to handle callers that
+       want more I/O after async closing (usually initiated by others). */
+    // XXX: add canReceive or s/canSend/canTalkToServer/
+    if (!canSend(fd))
+        return COMPLETE_NONPERSISTENT_MSG;
+
     /** \par
      * In chunked response we do not know the content length but we are absolutely
      * sure about the end of response, so we are calling the statusIfComplete to