mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
implement forced retiring of connection IDs
This commit is contained in:
parent
031c1709e6
commit
b9b44c60d3
2 changed files with 48 additions and 2 deletions
|
@ -8,10 +8,16 @@ import (
|
|||
)
|
||||
|
||||
var _ = Describe("Connection ID Manager", func() {
|
||||
var m *connIDManager
|
||||
var (
|
||||
m *connIDManager
|
||||
frameQueue []wire.Frame
|
||||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
m = &connIDManager{}
|
||||
frameQueue = nil
|
||||
m = newConnIDManager(func(f wire.Frame) {
|
||||
frameQueue = append(frameQueue, f)
|
||||
})
|
||||
})
|
||||
|
||||
get := func() (protocol.ConnectionID, *[16]byte) {
|
||||
|
@ -89,4 +95,26 @@ var _ = Describe("Connection ID Manager", func() {
|
|||
StatelessResetToken: [16]byte{0xe, 0xd, 0xc, 0xb, 0xa, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0},
|
||||
})).To(MatchError("received conflicting stateless reset tokens for sequence number 42"))
|
||||
})
|
||||
|
||||
It("retires connection IDs", func() {
|
||||
Expect(m.Add(&wire.NewConnectionIDFrame{
|
||||
SequenceNumber: 10,
|
||||
ConnectionID: protocol.ConnectionID{1, 2, 3, 4},
|
||||
})).To(Succeed())
|
||||
Expect(m.Add(&wire.NewConnectionIDFrame{
|
||||
SequenceNumber: 13,
|
||||
ConnectionID: protocol.ConnectionID{2, 3, 4, 5},
|
||||
})).To(Succeed())
|
||||
Expect(frameQueue).To(BeEmpty())
|
||||
Expect(m.Add(&wire.NewConnectionIDFrame{
|
||||
RetirePriorTo: 14,
|
||||
SequenceNumber: 17,
|
||||
ConnectionID: protocol.ConnectionID{3, 4, 5, 6},
|
||||
})).To(Succeed())
|
||||
Expect(frameQueue).To(HaveLen(2))
|
||||
Expect(frameQueue[0].(*wire.RetireConnectionIDFrame).SequenceNumber).To(BeEquivalentTo(10))
|
||||
Expect(frameQueue[1].(*wire.RetireConnectionIDFrame).SequenceNumber).To(BeEquivalentTo(13))
|
||||
c, _ := get()
|
||||
Expect(c).To(Equal(protocol.ConnectionID{3, 4, 5, 6}))
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue