forked from lix-project/lix
Fix race downloading into a sink
This fixes 'error 10 while decompressing xz file'. https://hydra.nixos.org/build/78308551
This commit is contained in:
parent
d9e8ab0ff2
commit
4b4adbc93d
|
@ -718,15 +718,17 @@ void Downloader::download(DownloadRequest && request, Sink & sink)
|
||||||
while (true) {
|
while (true) {
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
|
|
||||||
if (state->quit) {
|
|
||||||
if (state->exc) std::rethrow_exception(state->exc);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If no data is available, then wait for the download thread
|
/* If no data is available, then wait for the download thread
|
||||||
to wake us up. */
|
to wake us up. */
|
||||||
if (state->data.empty())
|
if (state->data.empty()) {
|
||||||
|
|
||||||
|
if (state->quit) {
|
||||||
|
if (state->exc) std::rethrow_exception(state->exc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
state.wait(state->avail);
|
state.wait(state->avail);
|
||||||
|
}
|
||||||
|
|
||||||
/* If data is available, then flush it to the sink and wake up
|
/* If data is available, then flush it to the sink and wake up
|
||||||
the download thread if it's blocked on a full buffer. */
|
the download thread if it's blocked on a full buffer. */
|
||||||
|
|
Loading…
Reference in a new issue