forked from quic-go/quic-go
don't send BlockedFrames after sending the FinBit for a stream
fixes #333
This commit is contained in:
@@ -119,7 +119,7 @@ func (f *streamFramer) maybePopNormalFrames(maxBytes protocol.ByteCount) (res []
|
||||
if f.flowControlManager.RemainingConnectionWindowSize() == 0 {
|
||||
// We are now connection-level FC blocked
|
||||
f.blockedFrameQueue = append(f.blockedFrameQueue, &frames.BlockedFrame{StreamID: 0})
|
||||
} else if sendWindowSize-frame.DataLen() == 0 {
|
||||
} else if !frame.FinBit && sendWindowSize-frame.DataLen() == 0 {
|
||||
// We are now stream-level FC blocked
|
||||
f.blockedFrameQueue = append(f.blockedFrameQueue, &frames.BlockedFrame{StreamID: s.StreamID()})
|
||||
}
|
||||
|
||||
@@ -387,13 +387,29 @@ var _ = Describe("Stream Framer", func() {
|
||||
It("queues and pops BLOCKED frames for individually blocked streams", func() {
|
||||
fcm.sendWindowSizes[stream1.StreamID()] = 3
|
||||
stream1.dataForWriting = []byte("foo")
|
||||
framer.PopStreamFrames(1000)
|
||||
frames := framer.PopStreamFrames(1000)
|
||||
Expect(frames).To(HaveLen(1))
|
||||
blockedFrame := framer.PopBlockedFrame()
|
||||
Expect(blockedFrame).ToNot(BeNil())
|
||||
Expect(blockedFrame.StreamID).To(Equal(stream1.StreamID()))
|
||||
Expect(framer.PopBlockedFrame()).To(BeNil())
|
||||
})
|
||||
|
||||
It("does not queue a stream-level BLOCKED frame after sending the FinBit frame", func() {
|
||||
fcm.sendWindowSizes[stream1.StreamID()] = 5000
|
||||
stream1.dataForWriting = []byte("foo")
|
||||
frames := framer.PopStreamFrames(1000)
|
||||
Expect(frames).To(HaveLen(1))
|
||||
Expect(frames[0].FinBit).To(BeFalse())
|
||||
stream1.closed = 1
|
||||
frames = framer.PopStreamFrames(1000)
|
||||
Expect(frames).To(HaveLen(1))
|
||||
Expect(frames[0].FinBit).To(BeTrue())
|
||||
Expect(frames[0].DataLen()).To(BeZero())
|
||||
blockedFrame := framer.PopBlockedFrame()
|
||||
Expect(blockedFrame).To(BeNil())
|
||||
})
|
||||
|
||||
It("queues and pops BLOCKED frames for connection blocked streams", func() {
|
||||
fcm.remainingConnectionWindowSize = 3
|
||||
fcm.streamsContributing = []protocol.StreamID{stream1.StreamID()}
|
||||
|
||||
Reference in New Issue
Block a user