]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
we may have a FD leak. lets cache the FD_CLOSE_REQUEST bit and
authorwessels <>
Wed, 25 Feb 1998 04:13:43 +0000 (04:13 +0000)
committerwessels <>
Wed, 25 Feb 1998 04:13:43 +0000 (04:13 +0000)
close it after the callback if we have to.

src/disk.cc

index 975b07093de03979e6cb47af26c5d04349029ec8..03904ca385d95a349e91342436e3076ff6a4a99f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: disk.cc,v 1.107 1998/02/24 16:39:22 wessels Exp $
+ * $Id: disk.cc,v 1.108 1998/02/24 21:13:43 wessels Exp $
  *
  * DEBUG: section 6     Disk I/O Routines
  * AUTHOR: Harvest Derived
@@ -296,6 +296,7 @@ diskHandleWriteComplete(void *data, int len, int errcode)
     dwrite_q *q = fdd->write_q;
     int status = DISK_OK;
     int do_callback;
+    int do_close;
     errno = errcode;
     debug(6, 3) ("diskHandleWriteComplete: FD %d len = %d\n", fd, len);
 #if USE_ASYNC_IO
@@ -393,6 +394,7 @@ diskHandleWriteComplete(void *data, int len, int errcode)
        commSetSelect(fd, COMM_SELECT_WRITE, diskHandleWrite, NULL, 0);
        EBIT_SET(F->flags, FD_WRITE_DAEMON);
     }
+    do_close = EBIT_TEST(F->flags, FD_CLOSE_REQUEST);
     if (fdd->wrt_handle) {
        if (fdd->wrt_handle_data == NULL)
            do_callback = 1;
@@ -410,7 +412,7 @@ diskHandleWriteComplete(void *data, int len, int errcode)
         */
        return;
     }
-    if (EBIT_TEST(F->flags, FD_CLOSE_REQUEST))
+    if (do_close)
        file_close(fd);
 }