forked from quic-go/quic-go
add a function to distinguish between long and short header packets (#3498)
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/lucas-clemente/quic-go"
|
||||
quicproxy "github.com/lucas-clemente/quic-go/integrationtests/tools/proxy"
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/wire"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
@@ -73,7 +74,7 @@ var _ = Describe("Datagram test", func() {
|
||||
return false
|
||||
}
|
||||
// don't drop Long Header packets
|
||||
if packet[0]&0x80 == 1 {
|
||||
if wire.IsLongHeaderPacket(packet[0]) {
|
||||
return false
|
||||
}
|
||||
drop := mrand.Int()%10 == 0
|
||||
|
||||
@@ -732,7 +732,7 @@ var _ = Describe("0-RTT", func() {
|
||||
proxy, err := quicproxy.NewQuicProxy("localhost:0", &quicproxy.Opts{
|
||||
RemoteAddr: ln.Addr().String(),
|
||||
DelayPacket: func(dir quicproxy.Direction, data []byte) time.Duration {
|
||||
if dir == quicproxy.DirectionIncoming && data[0]&0x80 > 0 && data[0]&0x30>>4 == 0 { // Initial packet from client
|
||||
if dir == quicproxy.DirectionIncoming && wire.IsLongHeaderPacket(data[0]) && data[0]&0x30>>4 == 0 { // Initial packet from client
|
||||
return rtt/2 + rtt
|
||||
}
|
||||
return rtt / 2
|
||||
|
||||
Reference in New Issue
Block a user