forked from lix-project/lix
Flush data when download ends
This commit is contained in:
parent
78fea899e0
commit
aa18404ecb
|
@ -828,17 +828,18 @@ void FileTransfer::download(FileTransferRequest && request, Sink & sink)
|
||||||
{
|
{
|
||||||
auto state(_state->lock());
|
auto state(_state->lock());
|
||||||
|
|
||||||
if (state->quit) {
|
if (state->data.empty()) {
|
||||||
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);
|
||||||
|
|
||||||
|
if (state->data.empty()) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue