v2ray-core/transport/internet/quic/pool.go

24 lines
260 B
Go
Raw Normal View History

2019-02-01 19:08:21 +00:00
// +build !confonly
2018-11-21 15:47:06 +00:00
package quic
import (
"sync"
"v2ray.com/core/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)
}