From: wessels <> Date: Thu, 1 Jan 1998 12:48:38 +0000 (+0000) Subject: - Fix bug from Henrik's patch. We can't set the FD timeout after X-Git-Tag: SQUID_3_0_PRE1~4306 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0ca54a5124a67ec318433fd5f7478fa0a17ef3c0;p=thirdparty%2Fsquid.git - Fix bug from Henrik's patch. We can't set the FD timeout after calling clientReadRequest() because the FD might be closed by then. - Add an assertion in commSetTimeout() that the FD be open. --- diff --git a/src/client_side.cc b/src/client_side.cc index 9f3be05a73..97698f09fe 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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); diff --git a/src/comm.cc b/src/comm.cc index eba3aa9948..57289044e5 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -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;