diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-03-01T15·07+0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-03-01T15·07+0100 |
commit | f61f67ddee12a976a0a6a20652e7c545b49fa46c (patch) | |
tree | f31e33eaa184861271baa9e10c00e809b70ba3df /src/libutil | |
parent | 374908726b87f6cd137ea7d097fdcda57003594e (diff) |
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).
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/serialise.hh | 9 |
1 files changed, 5 insertions, 4 deletions
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<std::string> data; + TeeSource(Source & orig) + : orig(orig), data(make_ref<std::string>()) { } 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; } }; |