ackhandler: use a frame handler interface for OnAcked / OnLost of all frame types (#3888)

This commit is contained in:
Marten Seemann 2023-06-04 23:04:28 +03:00 committed by GitHub
parent bde283640b
commit e1bcedc78c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 229 additions and 117 deletions

View file

@ -89,6 +89,13 @@ var _ = Describe("Retransmission queue", func() {
Expect(q.HasInitialData()).To(BeFalse())
Expect(q.GetInitialFrame(protocol.MaxByteCount, protocol.Version1)).To(BeNil())
})
It("retransmits a frame", func() {
f := &wire.MaxDataFrame{MaximumData: 0x42}
q.InitialAckHandler().OnLost(f)
Expect(q.HasInitialData()).To(BeTrue())
Expect(q.GetInitialFrame(protocol.MaxByteCount, protocol.Version1)).To(Equal(f))
})
})
Context("Handshake data", func() {
@ -165,6 +172,13 @@ var _ = Describe("Retransmission queue", func() {
Expect(q.HasHandshakeData()).To(BeFalse())
Expect(q.GetHandshakeFrame(protocol.MaxByteCount, protocol.Version1)).To(BeNil())
})
It("retransmits a frame", func() {
f := &wire.MaxDataFrame{MaximumData: 0x42}
q.HandshakeAckHandler().OnLost(f)
Expect(q.HasHandshakeData()).To(BeTrue())
Expect(q.GetHandshakeFrame(protocol.MaxByteCount, protocol.Version1)).To(Equal(f))
})
})
Context("Application data", func() {
@ -181,5 +195,12 @@ var _ = Describe("Retransmission queue", func() {
Expect(q.GetAppDataFrame(f.Length(protocol.Version1), protocol.Version1)).To(Equal(f))
Expect(q.HasAppData()).To(BeFalse())
})
It("retransmits a frame", func() {
f := &wire.MaxDataFrame{MaximumData: 0x42}
q.AppDataAckHandler().OnLost(f)
Expect(q.HasAppData()).To(BeTrue())
Expect(q.GetAppDataFrame(protocol.MaxByteCount, protocol.Version1)).To(Equal(f))
})
})
})