mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
sourceToSink(): Throw EndOfFile
This commit is contained in:
parent
0194f81587
commit
609df83c01
2 changed files with 4 additions and 6 deletions
|
@ -1245,7 +1245,6 @@ StorePath LocalStore::addToStoreFromDump(
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
got = source.read(dumpBuffer.get() + oldSize, want);
|
got = source.read(dumpBuffer.get() + oldSize, want);
|
||||||
if (!got) break;
|
|
||||||
} catch (EndOfFile &) {
|
} catch (EndOfFile &) {
|
||||||
inMemory = true;
|
inMemory = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -246,9 +246,8 @@ std::unique_ptr<FinishSink> sourceToSink(std::function<void(Source &)> fun)
|
||||||
LambdaSource source([&](char * out, size_t out_len) {
|
LambdaSource source([&](char * out, size_t out_len) {
|
||||||
if (cur.empty()) {
|
if (cur.empty()) {
|
||||||
yield();
|
yield();
|
||||||
if (yield.get()) {
|
if (yield.get())
|
||||||
return (size_t) 0;
|
throw EndOfFile("coroutine has finished");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t n = std::min(cur.size(), out_len);
|
size_t n = std::min(cur.size(), out_len);
|
||||||
|
@ -271,12 +270,12 @@ std::unique_ptr<FinishSink> sourceToSink(std::function<void(Source &)> fun)
|
||||||
void finish() override
|
void finish() override
|
||||||
{
|
{
|
||||||
if (!coro) return;
|
if (!coro) return;
|
||||||
//if (!*coro) abort();
|
if (!*coro) abort();
|
||||||
{
|
{
|
||||||
CoroutineContext ctx;
|
CoroutineContext ctx;
|
||||||
(*coro)(true);
|
(*coro)(true);
|
||||||
}
|
}
|
||||||
//if (*coro) abort();
|
if (*coro) abort();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue