fix handling of duplicate FIN bits after a stream was canceled

This commit is contained in:
Marten Seemann 2019-11-09 10:03:37 +07:00
parent e6e343fc39
commit 63585d1b5e
2 changed files with 23 additions and 2 deletions

View file

@ -538,6 +538,25 @@ var _ = Describe("Receive Stream", func() {
FinBit: true,
})).To(Succeed())
})
It("handles duplicate FinBits after the stream was canceled", func() {
mockSender.EXPECT().queueControlFrame(gomock.Any())
str.CancelRead(1234)
gomock.InOrder(
mockFC.EXPECT().UpdateHighestReceived(protocol.ByteCount(1000), true),
mockFC.EXPECT().Abandon(),
mockFC.EXPECT().UpdateHighestReceived(protocol.ByteCount(1000), true),
)
mockSender.EXPECT().onStreamCompleted(streamID)
Expect(str.handleStreamFrame(&wire.StreamFrame{
Offset: 1000,
FinBit: true,
})).To(Succeed())
Expect(str.handleStreamFrame(&wire.StreamFrame{
Offset: 1000,
FinBit: true,
})).To(Succeed())
})
})
Context("receiving RESET_STREAM frames", func() {
@ -564,7 +583,7 @@ var _ = Describe("Receive Stream", func() {
mockFC.EXPECT().UpdateHighestReceived(protocol.ByteCount(42), true),
mockFC.EXPECT().Abandon(),
)
str.handleResetStreamFrame(rst)
Expect(str.handleResetStreamFrame(rst)).To(Succeed())
Eventually(done).Should(BeClosed())
})