You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Xray-core/transport/internet/quic/pool.go

22 lines
250 B

4 years ago
package quic
import (
"sync"
4 years ago
"github.com/xtls/xray-core/common/bytespool"
4 years ago
)
var pool *sync.Pool
func init() {
pool = bytespool.GetPool(2048)
}
func getBuffer() []byte {
return pool.Get().([]byte)
}
func putBuffer(p []byte) {
pool.Put(p)
}