]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Avoid !closing assertions when helpers call comm_read [during reconfigure].
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 11 May 2013 15:23:59 +0000 (09:23 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sat, 11 May 2013 15:23:59 +0000 (09:23 -0600)
While helper reading code does check for COMM_ERR_CLOSING, it is not sufficient
because helperReturnBuffer() called by the reading code may notice the helper
shutdown flag (set earlier by reconfigure) and start closing the connection
underneath the reading code feet.

src/helper.cc

index bd238197ee9c3f1db88596ffa0d5c13614813b23..55c47208676c92f92d988088d3d20fe337b98637 100644 (file)
@@ -36,6 +36,7 @@
 #include "comm/Connection.h"
 #include "comm/Write.h"
 #include "fd.h"
+#include "fde.h"
 #include "format/Quoting.h"
 #include "helper.h"
 #include "Mem.h"
@@ -957,7 +958,7 @@ helperHandleRead(const Comm::ConnectionPointer &conn, char *buf, size_t len, com
         srv->rbuf[srv->roffset] = '\0';
     }
 
-    if (Comm::IsConnOpen(srv->readPipe)) {
+    if (Comm::IsConnOpen(srv->readPipe) && !fd_table[srv->readPipe->fd].closing()) {
         int spaceSize = srv->rbuf_sz - srv->roffset - 1;
         assert(spaceSize >= 0);
 
@@ -1078,7 +1079,7 @@ helperStatefulHandleRead(const Comm::ConnectionPointer &conn, char *buf, size_t
             helperStatefulReleaseServer(srv);
     }
 
-    if (Comm::IsConnOpen(srv->readPipe)) {
+    if (Comm::IsConnOpen(srv->readPipe) && !fd_table[srv->readPipe->fd].closing()) {
         int spaceSize = srv->rbuf_sz - srv->roffset - 1;
         assert(spaceSize >= 0);