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

24 lines
271 B
Go
Raw Normal View History

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