1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-27 14:26:11 -04:00

rename buf pool membership status to unmanaged

This commit is contained in:
Shelikhoo 2021-11-07 22:34:39 +00:00
parent d781cc0cfd
commit 802780e9e1
No known key found for this signature in database
GPG Key ID: AA7BC347968E7DB1

View File

@ -17,10 +17,10 @@ var pool = bytespool.GetPool(Size)
// the buffer into an internal buffer pool, in order to recreate a buffer more // the buffer into an internal buffer pool, in order to recreate a buffer more
// quickly. // quickly.
type Buffer struct { type Buffer struct {
v []byte v []byte
start int32 start int32
end int32 end int32
out bool unmanaged bool
} }
// New creates a Buffer with 0 length and 2K capacity. // New creates a Buffer with 0 length and 2K capacity.
@ -33,9 +33,9 @@ func New() *Buffer {
// As creates a Buffer with an existed bytearray // As creates a Buffer with an existed bytearray
func As(data []byte) *Buffer { func As(data []byte) *Buffer {
return &Buffer{ return &Buffer{
v: data, v: data,
end: int32(len(data)), end: int32(len(data)),
out: true, unmanaged: true,
} }
} }
@ -49,7 +49,7 @@ func StackNew() Buffer {
// Release recycles the buffer into an internal buffer pool. // Release recycles the buffer into an internal buffer pool.
func (b *Buffer) Release() { func (b *Buffer) Release() {
if b == nil || b.v == nil || b.out { if b == nil || b.v == nil || b.unmanaged {
return return
} }