mirror of https://github.com/v2ray/v2ray-core
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.
22 lines
239 B
22 lines
239 B
6 years ago
|
package quic
|
||
|
|
||
|
import (
|
||
|
"sync"
|
||
|
|
||
|
"v2ray.com/core/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)
|
||
|
}
|