Skip to content

Commit

Permalink
Notify from the main curl worker loop
Browse files Browse the repository at this point in the history
After the notification is done, the request may be deleted by the
owning S3File instance.  Do not call `Notify` from within the curl
result processing function as the request object needs to be alive
to release the curl handle.
  • Loading branch information
bbockelm committed Nov 27, 2024
1 parent 833d499 commit b055613
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions src/CurlUtil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ void CurlWorker::Run() {
"Processing result from curl");
op->ProcessCurlResult(iter->first, res);
op->ReleaseHandle(iter->first);
op->Notify();
running_handles -= 1;
curl_multi_remove_handle(multi_handle, iter->first);
if (res == CURLE_OK) {
Expand Down
3 changes: 0 additions & 3 deletions src/HTTPCommands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,6 @@ void HTTPRequest::Notify() {
HTTPRequest::CurlResult HTTPRequest::ProcessCurlResult(CURL *curl,
CURLcode rv) {

auto cleaner = [&](void *) { Notify(); };
auto unique = std::unique_ptr<void, decltype(cleaner)>((void *)1, cleaner);

if (rv != 0) {
if (errorCode.empty()) {
errorCode = "E_CURL_IO";
Expand Down

0 comments on commit b055613

Please sign in to comment.