1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-14 00:07:09 -05:00
v2fly/transport/internet/quic/pool.go

22 lines
278 B
Go
Raw Normal View History

2018-11-21 10:47:06 -05:00
package quic
import (
"sync"
"github.com/v2fly/v2ray-core/v5/common/bytespool"
2018-11-21 10:47:06 -05:00
)
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
2018-11-21 10:47:06 -05:00
}