simplify ReadBuffer

pull/1546/head
Darien Raymond 2019-02-10 10:53:16 +01:00
parent b0a015c7cc
commit a84897b4b6
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 2 additions and 13 deletions

View File

@ -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.