forked from quic-go/quic-go
queue lost STREAM frames in the stream's retransmission queue
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package quic
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/wire"
|
||||
|
||||
@@ -118,41 +116,5 @@ var _ = Describe("Retransmission queue", func() {
|
||||
Expect(q.GetAppDataFrame(f.Length(version) - 1)).To(BeNil())
|
||||
Expect(q.GetAppDataFrame(f.Length(version))).To(Equal(f))
|
||||
})
|
||||
|
||||
It("queues and retrieves a STREAM frame", func() {
|
||||
f := &wire.StreamFrame{Data: []byte("foobar")}
|
||||
q.AddAppData(f)
|
||||
Expect(q.GetAppDataFrame(f.Length(version) - 1)).To(BeNil())
|
||||
Expect(q.GetAppDataFrame(f.Length(version))).To(Equal(f))
|
||||
})
|
||||
|
||||
It("splits STREAM frames larger than MinStreamFrameSize", func() {
|
||||
data := make([]byte, 1000)
|
||||
rand.Read(data)
|
||||
f := &wire.StreamFrame{
|
||||
Data: data,
|
||||
FinBit: true,
|
||||
}
|
||||
q.AddAppData(f)
|
||||
Expect(q.GetAppDataFrame(protocol.MinStreamFrameSize - 1)).To(BeNil())
|
||||
f1 := q.GetAppDataFrame(protocol.MinStreamFrameSize).(*wire.StreamFrame)
|
||||
Expect(f1).ToNot(BeNil())
|
||||
Expect(f1.Length(version)).To(Equal(protocol.MinStreamFrameSize))
|
||||
Expect(f1.FinBit).To(BeFalse())
|
||||
Expect(f1.Data).To(Equal(data[:f1.DataLen()]))
|
||||
f2 := q.GetAppDataFrame(protocol.MaxByteCount).(*wire.StreamFrame)
|
||||
Expect(f2).ToNot(BeNil())
|
||||
Expect(f2.FinBit).To(BeTrue())
|
||||
Expect(f1.DataLen() + f2.DataLen()).To(BeEquivalentTo(1000))
|
||||
Expect(f2.Data).To(Equal(data[f1.DataLen():]))
|
||||
Expect(q.GetAppDataFrame(protocol.MaxByteCount)).To(BeNil())
|
||||
})
|
||||
|
||||
It("returns a control frame if it doesn't split a STREAM frame", func() {
|
||||
cf := &wire.MaxDataFrame{ByteOffset: 0x42}
|
||||
q.AddAppData(&wire.StreamFrame{Data: make([]byte, 1000)})
|
||||
q.AddAppData(cf)
|
||||
Expect(q.GetAppDataFrame(protocol.MinStreamFrameSize - 1)).To(Equal(cf))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user