about summary refs log tree commit diff
path: root/src/libutil/serialise.hh
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-26T15·16+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-02T14·46+0100
commit89a2fa68aca83082b50132dd98a170bcce82dae9 (patch)
treefe4b02321b02e822febf24b8da5e26be54e84743 /src/libutil/serialise.hh
parentcca4a8dc1a622ab086639e5c09347303c062922e (diff)
FdSource: track number of bytes read
Diffstat (limited to 'src/libutil/serialise.hh')
-rw-r--r--src/libutil/serialise.hh10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh
index 9e269f3923ea..0fdc4037b2d7 100644
--- a/src/libutil/serialise.hh
+++ b/src/libutil/serialise.hh
@@ -76,11 +76,11 @@ struct BufferedSource : Source
 struct FdSink : BufferedSink
 {
     int fd;
-    bool warn;
-    size_t written;
+    bool warn = false;
+    size_t written = 0;
 
-    FdSink() : fd(-1), warn(false), written(0) { }
-    FdSink(int fd) : fd(fd), warn(false), written(0) { }
+    FdSink() : fd(-1) { }
+    FdSink(int fd) : fd(fd) { }
     ~FdSink();
 
     void write(const unsigned char * data, size_t len) override;
@@ -96,6 +96,8 @@ private:
 struct FdSource : BufferedSource
 {
     int fd;
+    size_t read = 0;
+
     FdSource() : fd(-1) { }
     FdSource(int fd) : fd(fd) { }
     size_t readUnbuffered(unsigned char * data, size_t len) override;