mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-17 12:33:01 +00:00
?
This commit is contained in:
parent
b977899926
commit
3531b95d82
@ -26,6 +26,13 @@ type Buffer struct {
|
|||||||
|
|
||||||
// New creates a Buffer with 0 length and 2K capacity.
|
// New creates a Buffer with 0 length and 2K capacity.
|
||||||
func New() *Buffer {
|
func New() *Buffer {
|
||||||
|
buf := pool.Get().([]byte)
|
||||||
|
if cap(buf) >= Size {
|
||||||
|
buf = buf[:Size]
|
||||||
|
} else {
|
||||||
|
buf = make([]byte, Size)
|
||||||
|
}
|
||||||
|
|
||||||
return &Buffer{
|
return &Buffer{
|
||||||
v: buf,
|
v: buf,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user