[PATCH] Move timeout handling from ConnOpener::connect to ConnOpener::timeout

From: Rainer Weikusat <rweikusat_at_mobileactivedefense.com>
Date: Mon, 14 Jan 2013 20:12:39 +0000

The attached patch moves the body of the timeout handling code from
the ConnOpener::connect method to the ConnOpener::timeout method
instead of invoking ::connect from ::timeout in order to make squid
enforced connect timeouts work (that is, abort the connection) instead
of wrongly making squid believe that the connect succeeded because the
getsockopt call done in comm_connect_addr won't return an error for
this case. This also means that there's now one connect timeout check
done in checkTimeouts instead of two whose results will usually
differ. An internal method named 'stillConnecting' is introduced which
contains the check for an 'abort done by the parent' which is presently
in ConnOpener::connect,

    // our parent Jobs signal abort by cancelling their callbacks.
    if (callback_ == NULL || callback_->canceled())
        return;

This method is called from both ::connect and ::timeout to determine
if the state of the connect request is still undecided by the time
either of both methods executes. This guards against the case that
both ::connect and ::timeout are scheduled before one of them
actually runs and detects when the 'other side' of a full
connection has already gone away or is in the process of going away
(and hence, the already existing 'result state' should be kept).

Received on Mon Jan 14 2013 - 20:13:08 MST

This archive was generated by hypermail 2.2.0 : Wed Jan 16 2013 - 12:00:06 MST