delete 0-RTT queues if no Initial is received within 100ms

This commit is contained in:
Marten Seemann
2020-01-03 16:32:19 +07:00
parent 2b7133a6e2
commit ba095dd3ff
3 changed files with 40 additions and 13 deletions

View File

@@ -2,6 +2,7 @@ package quic
import (
"encoding/binary"
"time"
"github.com/lucas-clemente/quic-go/internal/protocol"
@@ -85,4 +86,12 @@ var _ = Describe("0-RTT queue", func() {
// The queue should now be empty.
Expect(q.Dequeue(connID)).To(BeNil())
})
It("deletes packets if they aren't dequeued after a short while", func() {
connID := protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef}
p := &receivedPacket{data: []byte("foobar")}
q.Enqueue(connID, p)
time.Sleep(protocol.Max0RTTQueueingDuration * 3 / 2)
Expect(q.Dequeue(connID)).To(BeNil())
})
})