1
0
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:
Darien Raymond 2018-11-21 10:49:41 +01:00
parent 786290a31d
commit 14c2d415d2
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
231 changed files with 8 additions and 8 deletions

View File

@ -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
}
} }

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

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