From: Eduard Bagdasaryan Date: Mon, 6 Jul 2020 19:01:13 +0000 (+0300) Subject: Several fixes X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4e9c11d79e46baf29e73f3d606b524456495411b;p=thirdparty%2Fsquid.git Several fixes * The 'serverConn must be nil' requirement in FwdState::handleUnregisteredServerEnd() was probably wrong - this handler only guarantees that the connection itself has been closed. * Use a more suitable scInternalServerError instead of scBadGateway when reacting on a general error in FwdState::advanceDestination(). * Removed the !serverConn assertion from retryOrBail(): if we retry, this requirement is checked already in connectStart(); if we bail, we should not care about serverConn at all. --- diff --git a/src/FwdState.cc b/src/FwdState.cc index 05e3d4ddc0..94b5dbe699 100644 --- a/src/FwdState.cc +++ b/src/FwdState.cc @@ -744,8 +744,6 @@ FwdState::serverClosed(int fd) void FwdState::retryOrBail() { - assert(!serverConn); - if (checkRetry()) { debugs(17, 3, HERE << "re-forwarding (" << n_tries << " tries, " << (squid_curtime - start_t) << " secs)"); useDestinations(); @@ -781,7 +779,7 @@ FwdState::handleUnregisteredServerEnd() { debugs(17, 2, HERE << "self=" << self << " err=" << err << ' ' << entry->url()); assert(!Comm::IsConnOpen(serverConn)); - assert(!serverConn); + serverConn = nullptr; destinationReceipt = nullptr; retryOrBail(); } @@ -801,7 +799,7 @@ FwdState::advanceDestination(const char *stepDescription, const Comm::Connection debugs (17, 2, "exception while trying to " << stepDescription << ": " << CurrentException); closePendingConnection(conn, "connection preparation exception"); if (!err) { - auto error = new ErrorState(ERR_CONNECT_FAIL, Http::scBadGateway, request, al); + auto error = new ErrorState(ERR_CONNECT_FAIL, Http::scInternalServerError, request, al); fail(error); } retryOrBail(); @@ -1075,13 +1073,13 @@ FwdState::connectStart() assert(!destinations->empty()); assert(!opening()); + assert(!usingDestination()); // Ditch error page if it was created before. // A new one will be created if there's another problem delete err; err = nullptr; request->clearError(); - assert(!usingDestination()); request->hier.startPeerClock();