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

22 lines
250 B
Go
Raw Permalink Normal View History

2020-11-25 11:01:53 +00:00
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)
}