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,16 +828,15 @@ void FileTransfer::download(FileTransferRequest && request, Sink & sink)
{ {
auto state(_state->lock()); auto state(_state->lock());
while (state->data.empty()) { if (state->quit) {
if (state->exc) std::rethrow_exception(state->exc);
if (state->quit) { return;
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); chunk = std::move(state->data);
state->request.notify_one(); state->request.notify_one();