mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-28 13:49:58 +00:00
TUN-4597: Add a QUIC server skeleton
- Added a QUIC server to accept streams - Unit test for this server also tests ALPN - Temporary echo capability for HTTP ConnectionType
This commit is contained in:
33
vendor/github.com/lucas-clemente/quic-go/internal/wire/pool.go
generated
vendored
Normal file
33
vendor/github.com/lucas-clemente/quic-go/internal/wire/pool.go
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
package wire
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
)
|
||||
|
||||
var pool sync.Pool
|
||||
|
||||
func init() {
|
||||
pool.New = func() interface{} {
|
||||
return &StreamFrame{
|
||||
Data: make([]byte, 0, protocol.MaxPacketBufferSize),
|
||||
fromPool: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func GetStreamFrame() *StreamFrame {
|
||||
f := pool.Get().(*StreamFrame)
|
||||
return f
|
||||
}
|
||||
|
||||
func putStreamFrame(f *StreamFrame) {
|
||||
if !f.fromPool {
|
||||
return
|
||||
}
|
||||
if protocol.ByteCount(cap(f.Data)) != protocol.MaxPacketBufferSize {
|
||||
panic("wire.PutStreamFrame called with packet of wrong size!")
|
||||
}
|
||||
pool.Put(f)
|
||||
}
|
Reference in New Issue
Block a user