From 1f65b08d947d9ab7eb397eebe49609963e003641 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 29 Sep 2025 16:37:12 -0400 Subject: [PATCH] `curlFileTransfer::State:quit` emptys the queue Whoever first calls `quit` now empties the queue, instead of waiting for the worker thread to do it. (Note that in the unwinding case, the worker thread is still the first to call `quit`, though.) --- src/libstore/filetransfer.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index 72153dfdd..f8f5b48e0 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -603,6 +603,9 @@ struct curlFileTransfer : public FileTransfer void quit() { quitting = true; + /* We wil not be processing any more incomming requests */ + while (!incoming.empty()) + incoming.pop(); } bool isQuitting() @@ -787,8 +790,6 @@ struct curlFileTransfer : public FileTransfer { auto state(state_.lock()); - while (!state->incoming.empty()) - state->incoming.pop(); state->quit(); } }