]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- Fix bug from Henrik's patch. We can't set the FD timeout after
authorwessels <>
Thu, 1 Jan 1998 12:48:38 +0000 (12:48 +0000)
committerwessels <>
Thu, 1 Jan 1998 12:48:38 +0000 (12:48 +0000)
  calling clientReadRequest() because the FD might be closed by then.
- Add an assertion in commSetTimeout() that the FD be open.

src/client_side.cc
src/comm.cc

index 9f3be05a73c29b082cab012a2817ee4d880ad67d..97698f09fe19d3f1ce66d2b7af551005c6814192 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.183 1998/01/01 00:05:52 wessels Exp $
+ * $Id: client_side.cc,v 1.184 1998/01/01 05:48:38 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -1020,10 +1020,16 @@ clientWriteComplete(int fd, char *bufnotused, size_t size, int errflag, void *da
                        clientSendMoreData,
                        http);
            } else {
-               debug(12, 5) ("clientWriteComplete: FD %d Setting read handler for next request\n", fd);
+               debug(12, 5) ("clientWriteComplete: FD %d reading next request\n", fd);
                fd_note(fd, "Reading next request");
-               clientReadRequest(fd, conn); /* Read next request */
+               /*
+                * Set the timeout BEFORE calling clientReadRequest().
+                */
                commSetTimeout(fd, 15, requestTimeout, conn);
+               clientReadRequest(fd, conn); /* Read next request */
+               /*
+                * Note, the FD may be closed at this point.
+                */
            }
        } else {
            comm_close(fd);
index eba3aa99486e281ecee253b023a7b0335b864753..57289044e5c341db15b819afbe4498761a647ec5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.216 1997/12/31 22:13:20 wessels Exp $
+ * $Id: comm.cc,v 1.217 1998/01/01 05:48:39 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -466,6 +466,7 @@ commSetTimeout(int fd, int timeout, PF * handler, void *data)
     assert(fd >= 0);
     assert(fd < Squid_MaxFD);
     F = &fd_table[fd];
+    assert(F->open);
     if (timeout < 0) {
        F->timeout_handler = NULL;
        F->timeout_data = NULL;