From a84897b4b6009f9a083cf369d2125635cef3119d Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Sun, 10 Feb 2019 10:53:16 +0100 Subject: [PATCH] simplify ReadBuffer --- common/buf/reader.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/common/buf/reader.go b/common/buf/reader.go index f0c408b1c..d28316545 100644 --- a/common/buf/reader.go +++ b/common/buf/reader.go @@ -37,19 +37,8 @@ func ReadBuffer(r io.Reader) (*Buffer, error) { if nBytes > 0 { common.Must(b.WriteByte(firstByte[0])) } - for i := 0; i < 64; i++ { - _, err := b.ReadFrom(r) - if !b.IsEmpty() { - return b, nil - } - if err != nil { - b.Release() - return nil, err - } - } - - b.Release() - return nil, newError("Reader returns too many empty payloads.") + b.ReadFrom(r) + return b, nil } // BufferedReader is a Reader that keeps its internal buffer.