From 9a471db1109069a7832f11dfda09bc13574f922a Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Wed, 14 Jul 2021 16:18:11 -0400 Subject: [PATCH] fixup: Fix Downloader handling of last-resort callback requirements ... 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 | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Downloader.cc b/src/Downloader.cc index 36e62de454..4bfb7f5b45 100644 --- a/src/Downloader.cc +++ b/src/Downloader.cc @@ -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(); -- 2.47.2