allow 0-RTT resumption if the server's stream limit was increased

This commit is contained in:
Marten Seemann 2021-03-10 14:16:18 +08:00
parent 3bce408c8d
commit 3588cddd43
4 changed files with 83 additions and 22 deletions

View file

@ -483,7 +483,7 @@ var _ = Describe("Transport Parameters", func() {
Context("rejects the parameters if they changed", func() {
var p TransportParameters
params := &TransportParameters{
saved := &TransportParameters{
InitialMaxStreamDataBidiLocal: 1,
InitialMaxStreamDataBidiRemote: 2,
InitialMaxStreamDataUni: 3,
@ -494,43 +494,53 @@ var _ = Describe("Transport Parameters", func() {
}
BeforeEach(func() {
p = *params
Expect(params.ValidFor0RTT(&p)).To(BeTrue())
p = *saved
Expect(p.ValidFor0RTT(saved)).To(BeTrue())
})
It("rejects the parameters if the InitialMaxStreamDataBidiLocal changed", func() {
p.InitialMaxStreamDataBidiLocal = 0
Expect(params.ValidFor0RTT(&p)).To(BeFalse())
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
})
It("rejects the parameters if the InitialMaxStreamDataBidiRemote changed", func() {
p.InitialMaxStreamDataBidiRemote = 0
Expect(params.ValidFor0RTT(&p)).To(BeFalse())
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
})
It("rejects the parameters if the InitialMaxStreamDataUni changed", func() {
p.InitialMaxStreamDataUni = 0
Expect(params.ValidFor0RTT(&p)).To(BeFalse())
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
})
It("rejects the parameters if the InitialMaxData changed", func() {
p.InitialMaxData = 0
Expect(params.ValidFor0RTT(&p)).To(BeFalse())
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
})
It("rejects the parameters if the MaxBidiStreamNum changed", func() {
p.MaxBidiStreamNum = 0
Expect(params.ValidFor0RTT(&p)).To(BeFalse())
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
})
It("accepts the parameters if the MaxBidiStreamNum was increased", func() {
p.MaxBidiStreamNum = saved.MaxBidiStreamNum + 1
Expect(p.ValidFor0RTT(saved)).To(BeTrue())
})
It("rejects the parameters if the MaxUniStreamNum changed", func() {
p.MaxUniStreamNum = 0
Expect(params.ValidFor0RTT(&p)).To(BeFalse())
p.MaxUniStreamNum = saved.MaxUniStreamNum - 1
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
})
It("accepts the parameters if the MaxUniStreamNum was increased", func() {
p.MaxUniStreamNum = saved.MaxUniStreamNum + 1
Expect(p.ValidFor0RTT(saved)).To(BeTrue())
})
It("rejects the parameters if the ActiveConnectionIDLimit changed", func() {
p.ActiveConnectionIDLimit = 0
Expect(params.ValidFor0RTT(&p)).To(BeFalse())
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
})
})
})