mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
update vendor directory
This commit is contained in:
parent
786290a31d
commit
14c2d415d2
@ -3,25 +3,25 @@ package quic
|
|||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"v2ray.com/core/common/bytespool"
|
||||||
|
|
||||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
var bufferPool sync.Pool
|
var bufferPool *sync.Pool
|
||||||
|
|
||||||
func getPacketBuffer() *[]byte {
|
func getPacketBuffer() *[]byte {
|
||||||
return bufferPool.Get().(*[]byte)
|
b := bufferPool.Get().([]byte)
|
||||||
|
return &b
|
||||||
}
|
}
|
||||||
|
|
||||||
func putPacketBuffer(buf *[]byte) {
|
func putPacketBuffer(buf *[]byte) {
|
||||||
if cap(*buf) != int(protocol.MaxReceivePacketSize) {
|
if cap(*buf) < int(protocol.MaxReceivePacketSize) {
|
||||||
panic("putPacketBuffer called with packet of wrong size!")
|
panic("putPacketBuffer called with packet of wrong size!")
|
||||||
}
|
}
|
||||||
bufferPool.Put(buf)
|
bufferPool.Put(*buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
bufferPool.New = func() interface{} {
|
bufferPool = bytespool.GetPool(protocol.MaxReceivePacketSize)
|
||||||
b := make([]byte, 0, protocol.MaxReceivePacketSize)
|
|
||||||
return &b
|
|
||||||
}
|
|
||||||
}
|
}
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user