Merge pull request #14418 from lovesegfault/fix-curl-interrupt

fix(libstore/filetransfer): prevent double callback invocation on interrupt during retry
This commit is contained in:
Eelco Dolstra
2025-10-30 17:12:15 +00:00
committed by GitHub

View File

@@ -600,7 +600,14 @@ struct curlFileTransfer : public FileTransfer
decompressionSink.reset();
errorSink.reset();
embargo = std::chrono::steady_clock::now() + std::chrono::milliseconds(ms);
fileTransfer.enqueueItem(shared_from_this());
try {
fileTransfer.enqueueItem(shared_from_this());
} catch (const nix::Error & e) {
// If enqueue fails (e.g., during shutdown), fail the transfer properly
// instead of letting the exception propagate, which would leave done=false
// and cause the destructor to attempt a second callback invocation
fail(std::move(exc));
}
} else
fail(std::move(exc));
}