1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 17:46:58 -05:00

add check for largeSize in case there is just one pool

This commit is contained in:
Darien Raymond 2018-04-06 21:13:29 +02:00
parent 758723516e
commit 8f7bdede4e
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -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()
}