diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-03-21T22·46+0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2018-03-21T22·46+0100 |
commit | ec91840e70a7dbe59669e08f83ddad149bfba906 (patch) | |
tree | abae17314da14874e65b7cbf420fc1ac20b61a03 /src/libstore | |
parent | 97002b684c902dadcd351a67208f9c2a88ff8f8f (diff) |
Also make the backwards compatible case of RemoteStore::addToStore run in constant memory
Just because we can.
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/remote-store.cc | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index 1fd33c5a9bde..080cef93d214 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -385,21 +385,21 @@ void RemoteStore::addToStore(const ValidPathInfo & info, Source & source, if (GET_PROTOCOL_MINOR(conn->daemonVersion) < 18) { conn->to << wopImportPaths; - StringSink sink; - sink << 1 // == path follows - ; - copyNAR(source, sink); - sink - << exportMagic - << info.path - << info.references - << info.deriver - << 0 // == no legacy signature - << 0 // == no path follows - ; - - StringSource source(*sink.s); - conn->processStderr(0, &source); + auto source2 = sinkToSource([&](Sink & sink) { + sink << 1 // == path follows + ; + copyNAR(source, sink); + sink + << exportMagic + << info.path + << info.references + << info.deriver + << 0 // == no legacy signature + << 0 // == no path follows + ; + }); + + conn->processStderr(0, source2.get()); auto importedPaths = readStorePaths<PathSet>(*this, conn->from); assert(importedPaths.size() <= 1); |