From 2f5d50164398ade49859cc44d45654f12c468608 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Fri, 3 Nov 2017 13:19:48 +0100 Subject: [PATCH] fix length calculation in bufferToBytesReader.WriteTo --- common/buf/reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/buf/reader.go b/common/buf/reader.go index fce13c9ba..cade2a787 100644 --- a/common/buf/reader.go +++ b/common/buf/reader.go @@ -73,10 +73,10 @@ func (r *bufferToBytesReader) writeToInternal(writer io.Writer) (int64, error) { mbWriter := NewWriter(writer) totalBytes := int64(0) if r.leftOver != nil { + totalBytes += int64(r.leftOver.Len()) if err := mbWriter.Write(r.leftOver); err != nil { return 0, err } - totalBytes += int64(r.leftOver.Len()) } for {