From 8f7bdede4ee4f297941d16423ca6b2ab865a16bd Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Fri, 6 Apr 2018 21:13:29 +0200 Subject: [PATCH] add check for largeSize in case there is just one pool --- common/buf/reader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/buf/reader.go b/common/buf/reader.go index d652e86a8..28b9fb847 100644 --- a/common/buf/reader.go +++ b/common/buf/reader.go @@ -23,7 +23,7 @@ func (r *BytesToBufferReader) readSmall() (MultiBuffer, error) { b := New() for i := 0; i < 64; i++ { err := b.Reset(ReadFrom(r.Reader)) - if b.IsFull() { + if b.IsFull() && largeSize > Size { r.buffer = newBytes(Size + 1) } if !b.IsEmpty() { @@ -45,7 +45,7 @@ func (r *BytesToBufferReader) freeBuffer() { // ReadMultiBuffer implements Reader. func (r *BytesToBufferReader) ReadMultiBuffer() (MultiBuffer, error) { - if r.buffer == nil { + if r.buffer == nil || largeSize == Size { return r.readSmall() }