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:
commit
2cc53201eb
1 changed files with 8 additions and 1 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue