Advertisement
Guest User

Untitled

a guest
May 18th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
  2. index ea86ef05..c559b583 100644
  3. --- a/src/libstore/remote-store.cc
  4. +++ b/src/libstore/remote-store.cc
  5. @@ -439,13 +439,24 @@ Path RemoteStore::addToStore(const string & name, const Path & _srcPath,
  6. try {
  7. conn->to.written = 0;
  8. conn->to.warn = true;
  9. +
  10. + /* Increase the capacity because the 'filter' function could
  11. + issue more calls, which would otherwise deadlock. */
  12. connections->incCapacity();
  13. - {
  14. - Finally cleanup([&]() { connections->decCapacity(); });
  15. + Finally cleanup([&]() { connections->decCapacity(); });
  16. +
  17. + std::unique_ptr<Source> source;
  18. +
  19. + if (GET_PROTOCOL_MINOR(conn->daemonVersion) >= 22) {
  20. + source = sinkToSource([&](Sink & sink) {
  21. + dumpPath(srcPath, sink, filter);
  22. + });
  23. + } else
  24. dumpPath(srcPath, conn->to, filter);
  25. - }
  26. +
  27. conn->to.warn = false;
  28. - conn->processStderr();
  29. + conn->processStderr(0, source ? &*source : nullptr);
  30. +
  31. } catch (SysError & e) {
  32. /* Daemon closed while we were sending the path. Probably OOM
  33. or I/O error. */
  34. diff --git a/src/libstore/worker-protocol.hh b/src/libstore/worker-protocol.hh
  35. index 5ebdfaf1..b9bd5ca6 100644
  36. --- a/src/libstore/worker-protocol.hh
  37. +++ b/src/libstore/worker-protocol.hh
  38. @@ -6,7 +6,7 @@ namespace nix {
  39. #define WORKER_MAGIC_1 0x6e697863
  40. #define WORKER_MAGIC_2 0x6478696f
  41.  
  42. -#define PROTOCOL_VERSION 0x115
  43. +#define PROTOCOL_VERSION 0x116
  44. #define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
  45. #define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
  46.  
  47. diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
  48. index 55611b7d..a3cce01f 100644
  49. --- a/src/nix-daemon/nix-daemon.cc
  50. +++ b/src/nix-daemon/nix-daemon.cc
  51. @@ -349,22 +349,35 @@ static void performOp(TunnelLogger * logger, ref<LocalStore> store,
  52. }
  53. HashType hashAlgo = parseHashType(s);
  54.  
  55. - TeeSource savedNAR(from);
  56. - RetrieveRegularNARSink savedRegular;
  57. -
  58. - if (recursive) {
  59. - /* Get the entire NAR dump from the client and save it to
  60. - a string so that we can pass it to
  61. - addToStoreFromDump(). */
  62. - ParseSink sink; /* null sink; just parse the NAR */
  63. - parseDump(sink, savedNAR);
  64. - } else
  65. - parseDump(savedRegular, from);
  66. + if (GET_PROTOCOL_MINOR(clientVersion) < 22) {
  67.  
  68. - logger->startWork();
  69. - if (!savedRegular.regular) throw Error("regular file expected");
  70. - Path path = store->addToStoreFromDump(recursive ? *savedNAR.data : savedRegular.s, baseName, recursive, hashAlgo);
  71. - logger->stopWork();
  72. + TeeSource savedNAR(from);
  73. + RetrieveRegularNARSink savedRegular;
  74. +
  75. + if (recursive) {
  76. + /* Get the entire NAR dump from the client and save it to
  77. + a string so that we can pass it to
  78. + addToStoreFromDump(). */
  79. + ParseSink sink; /* null sink; just parse the NAR */
  80. + parseDump(sink, savedNAR);
  81. + } else
  82. + parseDump(savedRegular, from);
  83. +
  84. + logger->startWork();
  85. + if (!savedRegular.regular) throw Error("regular file expected");
  86. + Path path = store->addToStoreFromDump(recursive ? *savedNAR.data : savedRegular.s, baseName, recursive, hashAlgo);
  87. + logger->stopWork();
  88. +
  89. + } else {
  90. +
  91. + logger->startWork();
  92. +
  93. + // FIXME
  94. + store->addToStore(...);
  95. +
  96. + logger->stopWork();
  97. +
  98. + }
  99.  
  100. to << path;
  101. break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement