Check interupts even when download stalled

This commit is contained in:
Guillaume Maudoux 2023-02-09 13:56:50 +01:00
parent e4a2a5c074
commit 78fea899e0

View file

@ -828,15 +828,14 @@ void FileTransfer::download(FileTransferRequest && request, Sink & sink)
{ {
auto state(_state->lock()); auto state(_state->lock());
while (state->data.empty()) {
if (state->quit) { if (state->quit) {
if (state->exc) std::rethrow_exception(state->exc); if (state->exc) std::rethrow_exception(state->exc);
return; return;
} }
state.wait(state->avail); state.wait(state->avail);
}
if (state->data.empty()) continue;
chunk = std::move(state->data); chunk = std::move(state->data);