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

24 lines
271 B
Go
Raw Normal View History

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