From 97c76c46556e5c01f6e895b670311cba09e7d57c Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sun, 27 Oct 2024 18:27:11 +0100 Subject: [PATCH] libstore: remove TransferItem::active it's always legal to call curl_multi_remove_handle on a valid pair of multi and easy handles. removing an easy handle that is not currently attached to a multi handle is a no-op, and removing an easy handle of a different multi handle is something we can't reasonably trigger. if we *did* ever manage it would result in an error we'd ignore, and the handles in question would not be changed at all. this is just simpler Change-Id: I85ec62ff89385981ca49d243376b9c32586bd128 --- src/libstore/filetransfer.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index 97411bdf3..b1a1a4bcf 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -56,7 +56,6 @@ struct curlFileTransfer : public FileTransfer callback; std::function dataCallback; CURL * req; // must never be nullptr - bool active = false; // whether the handle has been added to the multi object std::string statusMsg; unsigned int attempt = 0; @@ -126,8 +125,7 @@ struct curlFileTransfer : public FileTransfer ~TransferItem() { - if (active) - curl_multi_remove_handle(fileTransfer.curlm, req); + curl_multi_remove_handle(fileTransfer.curlm, req); curl_easy_cleanup(req); if (requestHeaders) curl_slist_free_all(requestHeaders); try { @@ -557,7 +555,6 @@ struct curlFileTransfer : public FileTransfer assert(i != items.end()); i->second->finish(msg->data.result); curl_multi_remove_handle(curlm, i->second->req); - i->second->active = false; items.erase(i); } } @@ -603,7 +600,6 @@ struct curlFileTransfer : public FileTransfer debug("starting %s of %s", item->verb(), item->uri); item->init(); curl_multi_add_handle(curlm, item->req); - item->active = true; items[item->req] = item; } }