From: hno <> Date: Fri, 19 Apr 2002 12:26:26 +0000 (+0000) Subject: Syntactic restructuring of commSetTimeout to make the function more X-Git-Tag: SQUID_3_0_PRE1~1051 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5849612fd2ae66e672a95d42d19d2e9404fac832;p=thirdparty%2Fsquid.git Syntactic restructuring of commSetTimeout to make the function more obvious, oblivating the need of a comment explaining what it going on. --- diff --git a/src/comm.cc b/src/comm.cc index 7f71414035..74337c1e55 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.330 2002/04/18 16:09:37 hno Exp $ + * $Id: comm.cc,v 1.331 2002/04/19 06:26:26 hno Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -442,18 +442,15 @@ commSetTimeout(int fd, int timeout, PF * handler, void *data) cbdataReferenceDone(F->timeout_data); F->timeout_handler = NULL; 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); + } else { + assert(handler || F->timeout_handler); + if (handler) { + cbdataReferenceDone(F->timeout_data); + F->timeout_handler = handler; + F->timeout_data = cbdataReference(data); + } + F->timeout = squid_curtime + (time_t) timeout; } - F->timeout = squid_curtime + (time_t) timeout; return F->timeout; }