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

24 lines
274 B
Go
Raw Normal View History

2020-11-25 11:01:53 +00:00
// +build !confonly
package quic
import (
"sync"
"github.com/xtls/xray-core/v1/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)
}