Merge pull request #2280 from lucas-clemente/zero-rtt-queue

queue 0-RTT for 100ms to allow the corresponding Initial to arrive
This commit is contained in:
Marten Seemann
2020-02-20 16:44:03 +07:00
committed by GitHub
6 changed files with 341 additions and 15 deletions

View File

@@ -12,7 +12,7 @@ const MaxPacketSizeIPv6 = 1232
const MaxCongestionWindowPackets = 10000
// MaxUndecryptablePackets limits the number of undecryptable packets that are queued in the session.
const MaxUndecryptablePackets = 10
const MaxUndecryptablePackets = 33
// ConnectionFlowControlMultiplier determines how much larger the connection flow control windows needs to be relative to any stream's flow control window
// This is the value that Chromium is using
@@ -39,6 +39,9 @@ const DefaultMaxIncomingStreams = 100
// DefaultMaxIncomingUniStreams is the maximum number of unidirectional streams that a peer may open
const DefaultMaxIncomingUniStreams = 100
// MaxServerUnprocessedPackets is the max number of packets stored in the server that are not yet processed.
const MaxServerUnprocessedPackets = 1024
// MaxSessionUnprocessedPackets is the max number of packets stored in each session that are not yet processed.
const MaxSessionUnprocessedPackets = MaxCongestionWindowPackets
@@ -158,3 +161,15 @@ const MaxAckDelayInclGranularity = MaxAckDelay + TimerGranularity
// KeyUpdateInterval is the maximum number of packets we send or receive before initiating a key udpate.
const KeyUpdateInterval = 100 * 1000
// Max0RTTQueueingDuration is the maximum time that we store 0-RTT packets in order to wait for the corresponding Initial to be received.
const Max0RTTQueueingDuration = 100 * time.Millisecond
// Max0RTTQueues is the maximum number of connections that we buffer 0-RTT packets for.
const Max0RTTQueues = 32
// Max0RTTQueueLen is the maximum number of 0-RTT packets that we buffer for each connection.
// When a new session is created, all buffered packets are passed to the session immediately.
// To avoid blocking, this value has to be smaller than MaxSessionUnprocessedPackets.
// To avoid packets being dropped as undecryptable by the session, this value has to be smaller than MaxUndecryptablePackets.
const Max0RTTQueueLen = 32

View File

@@ -0,0 +1,13 @@
package protocol
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Parameters", func() {
It("can queue more packets in the session than in the 0-RTT queue", func() {
Expect(MaxSessionUnprocessedPackets).To(BeNumerically(">", Max0RTTQueueLen))
Expect(MaxUndecryptablePackets).To(BeNumerically(">", Max0RTTQueueLen))
})
})