aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/filetransfer.cc
diff options
context:
space:
mode:
authorGuillaume Maudoux <guillaume.maudoux@tweag.io>2023-02-09 13:56:50 +0100
committerGuillaume Maudoux <guillaume.maudoux@tweag.io>2023-02-09 13:56:50 +0100
commit78fea899e0ea79447f64bfd2804cae84bba3b2f8 (patch)
treee057095526fc14f7429fcd7ee74975f63a4fc941 /src/libstore/filetransfer.cc
parente4a2a5c074f8faf947a8864ca2acea85a8fc6ab7 (diff)
Check interupts even when download stalled
Diffstat (limited to 'src/libstore/filetransfer.cc')
-rw-r--r--src/libstore/filetransfer.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc
index 756bd4423..2818043e8 100644
--- a/src/libstore/filetransfer.cc
+++ b/src/libstore/filetransfer.cc
@@ -828,15 +828,14 @@ void FileTransfer::download(FileTransferRequest && request, Sink & sink)
{
auto state(_state->lock());
- while (state->data.empty()) {
+ if (state->quit) {
+ if (state->exc) std::rethrow_exception(state->exc);
+ return;
+ }
- if (state->quit) {
- if (state->exc) std::rethrow_exception(state->exc);
- return;
- }
+ state.wait(state->avail);
- state.wait(state->avail);
- }
+ if (state->data.empty()) continue;
chunk = std::move(state->data);