]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
fixup: Fix Downloader handling of last-resort callback requirements
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 14 Jul 2021 20:18:11 +0000 (16:18 -0400)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 16 Jul 2021 17:33:09 +0000 (13:33 -0400)
... and simplify the corresponding code.

The previous branch commit missed a callException() case that stops the
job but should not be reported as a BUG related to callback maintenance
(it would be up to the callException() implementation to decide how to
report the caught exception). There might be (or there will) be other,
similar cases where the job is stopped prematurely for some non-BUG
reason beyond swanSong() knowledge.

src/Downloader.cc

index 36e62de454d47d8f486162f5573a48c4e28fec12..4bfb7f5b459d7c140f81246a465184f0644edfc0 100644 (file)
@@ -82,15 +82,8 @@ Downloader::swanSong()
 {
     debugs(33, 6, this);
 
-    if (callback_) {
-        // External callback cancellation makes our doneAll() true and, hence,
-        // may get us here. That outcome is not a bug.
-        if (!callback_->canceled()) {
-            debugs(83, DBG_IMPORTANT, "BUG: Unexpected state while downloading " << url_);
-            callBack(Http::scInternalServerError);
-        }
-        callback_ = nullptr;
-    }
+    if (callback_) // job-ending emergencies like noteAbort() or callException()
+        callBack(Http::scInternalServerError);
 
     if (context_) {
         context_->finished();