1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

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
commit 2cc53201eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -600,7 +600,14 @@ struct curlFileTransfer : public FileTransfer
decompressionSink.reset();
errorSink.reset();
embargo = std::chrono::steady_clock::now() + std::chrono::milliseconds(ms);
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));
}