mirror of https://github.com/v2ray/v2ray-core
release buffer if payload becomes small
parent
feb421d9e1
commit
b2d9364cb5
|
@ -47,6 +47,9 @@ func (r *BytesToBufferReader) ReadMultiBuffer() (MultiBuffer, error) {
|
||||||
if nBytes == len(r.buffer) && nBytes < xlSize {
|
if nBytes == len(r.buffer) && nBytes < xlSize {
|
||||||
freeBytes(r.buffer)
|
freeBytes(r.buffer)
|
||||||
r.buffer = newBytes(uint32(nBytes) + 1)
|
r.buffer = newBytes(uint32(nBytes) + 1)
|
||||||
|
} else if nBytes < Size {
|
||||||
|
freeBytes(r.buffer)
|
||||||
|
r.buffer = nil
|
||||||
}
|
}
|
||||||
return mb, nil
|
return mb, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue