]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
The cbdata update broke extension of comm timeouts
authorhno <>
Thu, 18 Apr 2002 22:09:37 +0000 (22:09 +0000)
committerhno <>
Thu, 18 Apr 2002 22:09:37 +0000 (22:09 +0000)
src/comm.cc

index a9f09a4dfe32b2c6d9b5ea624855d456043ca56b..7f71414035e4a9c599739083ca9823507db965a2 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.329 2002/04/13 23:07:49 hno Exp $
+ * $Id: comm.cc,v 1.330 2002/04/18 16:09:37 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -438,18 +438,23 @@ commSetTimeout(int fd, int timeout, PF * handler, void *data)
     assert(fd < Squid_MaxFD);
     F = &fd_table[fd];
     assert(F->flags.open);
-    cbdataReferenceDone(F->timeout_data);
-    F->timeout_handler = NULL;
     if (timeout < 0) {
+       cbdataReferenceDone(F->timeout_data);
        F->timeout_handler = NULL;
-       return F->timeout = 0;
+       F->timeout = 0;
+       return F->timeout;
     }
     assert(handler || F->timeout_handler);
     if (handler || data) {
+       /* new timeout handler installed. If NULL then the timeout
+        * is only extended
+        */
+       cbdataReferenceDone(F->timeout_data);
        F->timeout_handler = handler;
        F->timeout_data = cbdataReference(data);
     }
-    return F->timeout = squid_curtime + (time_t) timeout;
+    F->timeout = squid_curtime + (time_t) timeout;
+    return F->timeout;
 }
 
 int