error when receiving stream data with a larger offset than the final offset

This could happen when a peer send a STREAM frame with the Fin bit set,
and then sends STREAM frames with a higher offset.
This commit is contained in:
Marten Seemann
2017-10-25 10:43:29 +07:00
parent 816cf90ea7
commit 636bf4578c
2 changed files with 24 additions and 3 deletions

View File

@@ -110,6 +110,20 @@ var _ = Describe("Stream Flow controller", func() {
err := controller.UpdateHighestReceived(99, true)
Expect(err).To(MatchError(qerr.StreamDataAfterTermination))
})
It("accepts delayed data after receiving a final offset", func() {
err := controller.UpdateHighestReceived(300, true)
Expect(err).ToNot(HaveOccurred())
err = controller.UpdateHighestReceived(250, false)
Expect(err).ToNot(HaveOccurred())
})
It("errors when receiving a higher offset after receiving a final offset", func() {
err := controller.UpdateHighestReceived(200, true)
Expect(err).ToNot(HaveOccurred())
err = controller.UpdateHighestReceived(250, false)
Expect(err).To(MatchError(qerr.StreamDataAfterTermination))
})
})
Context("registering data read", func() {