mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
use the connection ID manager to save the server's stateless reset token
This commit is contained in:
parent
ffbb810fcc
commit
5203b026e3
3 changed files with 48 additions and 13 deletions
|
@ -11,14 +11,20 @@ var _ = Describe("Connection ID Manager", func() {
|
|||
var (
|
||||
m *connIDManager
|
||||
frameQueue []wire.Frame
|
||||
tokenAdded *[16]byte
|
||||
)
|
||||
initialConnID := protocol.ConnectionID{1, 1, 1, 1}
|
||||
|
||||
BeforeEach(func() {
|
||||
frameQueue = nil
|
||||
m = newConnIDManager(initialConnID, func(f wire.Frame) {
|
||||
frameQueue = append(frameQueue, f)
|
||||
})
|
||||
tokenAdded = nil
|
||||
m = newConnIDManager(
|
||||
initialConnID,
|
||||
func(token [16]byte) { tokenAdded = &token },
|
||||
func(f wire.Frame,
|
||||
) {
|
||||
frameQueue = append(frameQueue, f)
|
||||
})
|
||||
})
|
||||
|
||||
get := func() (protocol.ConnectionID, *[16]byte) {
|
||||
|
@ -38,6 +44,13 @@ var _ = Describe("Connection ID Manager", func() {
|
|||
Expect(m.Get()).To(Equal(protocol.ConnectionID{1, 2, 3, 4, 5}))
|
||||
})
|
||||
|
||||
It("sets the token for the first connection ID", func() {
|
||||
token := [16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
|
||||
m.SetStatelessResetToken(token)
|
||||
Expect(*m.activeStatelessResetToken).To(Equal(token))
|
||||
Expect(*tokenAdded).To(Equal(token))
|
||||
})
|
||||
|
||||
It("adds and gets connection IDs", func() {
|
||||
Expect(m.Add(&wire.NewConnectionIDFrame{
|
||||
SequenceNumber: 10,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue