From f61f67ddee12a976a0a6a20652e7c545b49fa46c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 1 Mar 2017 16:07:15 +0100 Subject: RemoteStore::addToStore(): Send NAR rather than string containing NAR This allows the NAR to be streamed in the future (though we're not doing that yet). --- src/libutil/serialise.hh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/libutil') diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh index 3072f422ea93..2bdee70807be 100644 --- a/src/libutil/serialise.hh +++ b/src/libutil/serialise.hh @@ -140,15 +140,16 @@ struct StringSource : Source /* Adapter class of a Source that saves all data read to `s'. */ -struct SavingSourceAdapter : Source +struct TeeSource : Source { Source & orig; - string s; - SavingSourceAdapter(Source & orig) : orig(orig) { } + ref data; + TeeSource(Source & orig) + : orig(orig), data(make_ref()) { } size_t read(unsigned char * data, size_t len) { size_t n = orig.read(data, len); - s.append((const char *) data, n); + this->data->append((const char *) data, n); return n; } }; -- cgit 1.4.1