Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
- index ea86ef05..c559b583 100644
- --- a/src/libstore/remote-store.cc
- +++ b/src/libstore/remote-store.cc
- @@ -439,13 +439,24 @@ Path RemoteStore::addToStore(const string & name, const Path & _srcPath,
- try {
- conn->to.written = 0;
- conn->to.warn = true;
- +
- + /* Increase the capacity because the 'filter' function could
- + issue more calls, which would otherwise deadlock. */
- connections->incCapacity();
- - {
- - Finally cleanup([&]() { connections->decCapacity(); });
- + Finally cleanup([&]() { connections->decCapacity(); });
- +
- + std::unique_ptr<Source> source;
- +
- + if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 22) {
- + source = sinkToSource([&](Sink & sink) {
- + dumpPath(srcPath, sink, filter);
- + });
- + } else
- dumpPath(srcPath, conn->to, filter);
- - }
- +
- conn->to.warn = false;
- - conn->processStderr();
- + conn->processStderr(0, source ? &*source : nullptr);
- +
- } catch (SysError & e) {
- /* Daemon closed while we were sending the path. Probably OOM
- or I/O error. */
- diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh
- index 5ebdfaf1..b9bd5ca6 100644
- --- a/src/libstore/worker-protocol.hh
- +++ b/src/libstore/worker-protocol.hh
- @@ -6,7 +6,7 @@ namespace nix {
- #define WORKER_MAGIC_1 0x6e697863
- #define WORKER_MAGIC_2 0x6478696f
- -#define PROTOCOL_VERSION 0x115
- +#define PROTOCOL_VERSION 0x116
- #define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
- #define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
- diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
- index 55611b7d..a3cce01f 100644
- --- a/src/nix-daemon/nix-daemon.cc
- +++ b/src/nix-daemon/nix-daemon.cc
- @@ -349,22 +349,35 @@ static void performOp(TunnelLogger * logger, ref<LocalStore> store,
- }
- HashType hashAlgo = parseHashType(s);
- - TeeSource savedNAR(from);
- - RetrieveRegularNARSink savedRegular;
- -
- - if (recursive) {
- - /* Get the entire NAR dump from the client and save it to
- - a string so that we can pass it to
- - addToStoreFromDump(). */
- - ParseSink sink; /* null sink; just parse the NAR */
- - parseDump(sink, savedNAR);
- - } else
- - parseDump(savedRegular, from);
- + if (GET_PROTOCOL_MINOR(clientVersion) < 22) {
- - logger->startWork();
- - if (!savedRegular.regular) throw Error("regular file expected");
- - Path path = store->addToStoreFromDump(recursive ? *savedNAR.data : savedRegular.s, baseName, recursive, hashAlgo);
- - logger->stopWork();
- + TeeSource savedNAR(from);
- + RetrieveRegularNARSink savedRegular;
- +
- + if (recursive) {
- + /* Get the entire NAR dump from the client and save it to
- + a string so that we can pass it to
- + addToStoreFromDump(). */
- + ParseSink sink; /* null sink; just parse the NAR */
- + parseDump(sink, savedNAR);
- + } else
- + parseDump(savedRegular, from);
- +
- + logger->startWork();
- + if (!savedRegular.regular) throw Error("regular file expected");
- + Path path = store->addToStoreFromDump(recursive ? *savedNAR.data : savedRegular.s, baseName, recursive, hashAlgo);
- + logger->stopWork();
- +
- + } else {
- +
- + logger->startWork();
- +
- + // FIXME
- + store->addToStore(...);
- +
- + logger->stopWork();
- +
- + }
- to << path;
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement