Skip to content

Commit 2cc5320

Browse files
authored
Merge pull request #14418 from lovesegfault/fix-curl-interrupt
fix(libstore/filetransfer): prevent double callback invocation on interrupt during retry
2 parents 720f693 + 560a596 commit 2cc5320

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/libstore/filetransfer.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,14 @@ struct curlFileTransfer : public FileTransfer
600600
decompressionSink.reset();
601601
errorSink.reset();
602602
embargo = std::chrono::steady_clock::now() + std::chrono::milliseconds(ms);
603-
fileTransfer.enqueueItem(shared_from_this());
603+
try {
604+
fileTransfer.enqueueItem(shared_from_this());
605+
} catch (const nix::Error & e) {
606+
// If enqueue fails (e.g., during shutdown), fail the transfer properly
607+
// instead of letting the exception propagate, which would leave done=false
608+
// and cause the destructor to attempt a second callback invocation
609+
fail(std::move(exc));
610+
}
604611
} else
605612
fail(std::move(exc));
606613
}

0 commit comments

Comments
 (0)