mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-04 09:17:32 -05:00
22 lines
278 B
Go
22 lines
278 B
Go
package quic
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/v2fly/v2ray-core/v4/common/bytespool"
|
|
)
|
|
|
|
var pool *sync.Pool
|
|
|
|
func init() {
|
|
pool = bytespool.GetPool(2048)
|
|
}
|
|
|
|
func getBuffer() []byte {
|
|
return pool.Get().([]byte)
|
|
}
|
|
|
|
func putBuffer(p []byte) {
|
|
pool.Put(p) // nolint: staticcheck
|
|
}
|