diff options
author | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2023-02-10 00:54:29 +0100 |
---|---|---|
committer | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2023-02-10 00:54:29 +0100 |
commit | aa18404ecb1fd9cbcb663355e8f5c26ff2b00694 (patch) | |
tree | 875d4225378908f15d0276405b4171bacd35e0c9 /src/libstore/filetransfer.cc | |
parent | 78fea899e0ea79447f64bfd2804cae84bba3b2f8 (diff) |
Flush data when download ends
Diffstat (limited to 'src/libstore/filetransfer.cc')
-rw-r--r-- | src/libstore/filetransfer.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index 2818043e8..a9a5d1389 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -828,17 +828,18 @@ void FileTransfer::download(FileTransferRequest && request, Sink & sink) { auto state(_state->lock()); - if (state->quit) { - if (state->exc) std::rethrow_exception(state->exc); - return; - } + if (state->data.empty()) { + 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; + if (state->data.empty()) continue; + } chunk = std::move(state->data); - state->request.notify_one(); } |