]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/tunnel.cc
Bug 5360: FwdState::noteDestinationsEnd() assertion "err" (#1767)
[thirdparty/squid.git] / src / tunnel.cc
index dca34bdc5d492d4f66c072c3580acf8ef49fe20a..81cd72cbb7688702738884dfd9107c1dc246c006 100644 (file)
@@ -1364,7 +1364,15 @@ TunnelStateData::noteDestinationsEnd(ErrorState *selectionError)
     }
 
     // destinationsFound, but none of them worked, and we were waiting for more
-    assert(savedError);
+    debugs(17, 7, "no more destinations to try after " << n_tries << " failed attempts");
+    if (!savedError) {
+        // retryOrBail() must be preceded by saveError(), but in case we forgot:
+        const auto finalError = new ErrorState(ERR_CANNOT_FORWARD, Http::scBadGateway, request.getRaw(), al);
+        static const auto d = MakeNamedErrorDetail("RETRY_TO_NONE");
+        finalError->detailError(d);
+        saveError(finalError);
+    } // else use actual error from last forwarding attempt
+
     // XXX: Honor clientExpectsConnectResponse() before replying.
     sendError(savedError, "all found paths have failed");
 }