forked from quic-go/quic-go
add a function to tell if there's app data in the retransmission queue
This commit is contained in:
@@ -47,6 +47,10 @@ func (q *retransmissionQueue) HasHandshakeData() bool {
|
||||
return len(q.handshakeCryptoData) > 0 || len(q.handshake) > 0
|
||||
}
|
||||
|
||||
func (q *retransmissionQueue) HasAppData() bool {
|
||||
return len(q.appData) > 0
|
||||
}
|
||||
|
||||
func (q *retransmissionQueue) AddAppData(f wire.Frame) {
|
||||
if _, ok := f.(*wire.StreamFrame); ok {
|
||||
panic("STREAM frames are handled with their respective streams.")
|
||||
|
||||
@@ -176,9 +176,12 @@ var _ = Describe("Retransmission queue", func() {
|
||||
|
||||
It("queues and retrieves a control frame", func() {
|
||||
f := &wire.MaxDataFrame{ByteOffset: 0x42}
|
||||
Expect(q.HasAppData()).To(BeFalse())
|
||||
q.AddAppData(f)
|
||||
Expect(q.HasAppData()).To(BeTrue())
|
||||
Expect(q.GetAppDataFrame(f.Length(version) - 1)).To(BeNil())
|
||||
Expect(q.GetAppDataFrame(f.Length(version))).To(Equal(f))
|
||||
Expect(q.HasAppData()).To(BeFalse())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user