--- squid-3.2.1/src/comm/ConnOpener.cc 2012-08-15 07:24:19.000000000 +0400 +++ squid-3.2.1/src/comm/ConnOpener.cc 2012-08-31 18:00:30.502889045 +0400 @@ -233,7 +233,7 @@ case COMM_INPROGRESS: // check for timeout FIRST. - if (squid_curtime - connectStart_ > connectTimeout_) { + if (squid_curtime - connectStart_ >= connectTimeout_) { debugs(5, 5, HERE << conn_ << ": * - ERR took too long already."); calls_.earlyAbort_->cancel("Comm::ConnOpener::connect timed out"); doneConnecting(COMM_TIMEOUT, errno); @@ -254,7 +254,7 @@ ++failRetries_; // check for timeout FIRST. - if (squid_curtime - connectStart_ > connectTimeout_) { + if (squid_curtime - connectStart_ >= connectTimeout_) { debugs(5, 5, HERE << conn_ << ": * - ERR took too long to receive response."); calls_.earlyAbort_->cancel("Comm::ConnOpener::connect timed out"); doneConnecting(COMM_TIMEOUT, errno); --- squid-3.2.1/src/comm.cc 2012-08-15 07:24:19.000000000 +0400 +++ squid-3.2.1/src/comm.cc 2012-08-31 18:50:00.327557309 +0400 @@ -863,7 +863,16 @@ x = getsockopt(sock, SOL_SOCKET, SO_ERROR, &err, &errlen); if (x == 0) + { + if (err == 0) + /* + * reality is merely an illusion.. + * so we have to make sure that the socket is really connected + */ + connect(sock, AI->ai_addr, AI->ai_addrlen); + else errno = err; + } #if _SQUID_SOLARIS_ /*