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
This commit is contained in:
parent
c82407fc1e
commit
97c76c4655
|
@ -56,7 +56,6 @@ struct curlFileTransfer : public FileTransfer
|
||||||
callback;
|
callback;
|
||||||
std::function<void(TransferItem &, std::string_view data)> dataCallback;
|
std::function<void(TransferItem &, std::string_view data)> dataCallback;
|
||||||
CURL * req; // must never be nullptr
|
CURL * req; // must never be nullptr
|
||||||
bool active = false; // whether the handle has been added to the multi object
|
|
||||||
std::string statusMsg;
|
std::string statusMsg;
|
||||||
|
|
||||||
unsigned int attempt = 0;
|
unsigned int attempt = 0;
|
||||||
|
@ -126,7 +125,6 @@ struct curlFileTransfer : public FileTransfer
|
||||||
|
|
||||||
~TransferItem()
|
~TransferItem()
|
||||||
{
|
{
|
||||||
if (active)
|
|
||||||
curl_multi_remove_handle(fileTransfer.curlm, req);
|
curl_multi_remove_handle(fileTransfer.curlm, req);
|
||||||
curl_easy_cleanup(req);
|
curl_easy_cleanup(req);
|
||||||
if (requestHeaders) curl_slist_free_all(requestHeaders);
|
if (requestHeaders) curl_slist_free_all(requestHeaders);
|
||||||
|
@ -557,7 +555,6 @@ struct curlFileTransfer : public FileTransfer
|
||||||
assert(i != items.end());
|
assert(i != items.end());
|
||||||
i->second->finish(msg->data.result);
|
i->second->finish(msg->data.result);
|
||||||
curl_multi_remove_handle(curlm, i->second->req);
|
curl_multi_remove_handle(curlm, i->second->req);
|
||||||
i->second->active = false;
|
|
||||||
items.erase(i);
|
items.erase(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -603,7 +600,6 @@ struct curlFileTransfer : public FileTransfer
|
||||||
debug("starting %s of %s", item->verb(), item->uri);
|
debug("starting %s of %s", item->verb(), item->uri);
|
||||||
item->init();
|
item->init();
|
||||||
curl_multi_add_handle(curlm, item->req);
|
curl_multi_add_handle(curlm, item->req);
|
||||||
item->active = true;
|
|
||||||
items[item->req] = item;
|
items[item->req] = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue