save the max_datagram_frame_size transport parameter in the session ticket (#4013)

* Add MaxDatagramFrameSize parameter in session ticket

* fix gofumpt issues

* Update integrationtests/self/zero_rtt_test.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* fix: correct comparsion of max_datagram_frame_size

* test: use constant MaxDatagramFrameSize for session ticket test

* fix grammar

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
This commit is contained in:
Ameagari 2023-08-19 10:16:16 +08:00 committed by GitHub
parent 443c6148b6
commit 6880f88089
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 263 additions and 0 deletions

View file

@ -503,6 +503,7 @@ var _ = Describe("Transport Parameters", func() {
MaxBidiStreamNum: protocol.StreamNum(getRandomValueUpTo(int64(protocol.MaxStreamCount))),
MaxUniStreamNum: protocol.StreamNum(getRandomValueUpTo(int64(protocol.MaxStreamCount))),
ActiveConnectionIDLimit: 2 + getRandomValueUpTo(math.MaxInt64-2),
MaxDatagramFrameSize: protocol.ByteCount(getRandomValueUpTo(int64(protocol.MaxDatagramFrameSize))),
}
Expect(params.ValidFor0RTT(params)).To(BeTrue())
b := params.MarshalForSessionTicket(nil)
@ -515,6 +516,7 @@ var _ = Describe("Transport Parameters", func() {
Expect(tp.MaxBidiStreamNum).To(Equal(params.MaxBidiStreamNum))
Expect(tp.MaxUniStreamNum).To(Equal(params.MaxUniStreamNum))
Expect(tp.ActiveConnectionIDLimit).To(Equal(params.ActiveConnectionIDLimit))
Expect(tp.MaxDatagramFrameSize).To(Equal(params.MaxDatagramFrameSize))
})
It("rejects the parameters if it can't parse them", func() {
@ -540,6 +542,7 @@ var _ = Describe("Transport Parameters", func() {
MaxBidiStreamNum: 5,
MaxUniStreamNum: 6,
ActiveConnectionIDLimit: 7,
MaxDatagramFrameSize: 1000,
}
BeforeEach(func() {
@ -611,6 +614,16 @@ var _ = Describe("Transport Parameters", func() {
p.ActiveConnectionIDLimit = 0
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
})
It("accepts the parameters if the MaxDatagramFrameSize was increased", func() {
p.MaxDatagramFrameSize = saved.MaxDatagramFrameSize + 1
Expect(p.ValidFor0RTT(saved)).To(BeTrue())
})
It("rejects the parameters if the MaxDatagramFrameSize reduced", func() {
p.MaxDatagramFrameSize = saved.MaxDatagramFrameSize - 1
Expect(p.ValidFor0RTT(saved)).To(BeFalse())
})
})
Context("client checks the parameters after successfully sending 0-RTT data", func() {
@ -623,6 +636,7 @@ var _ = Describe("Transport Parameters", func() {
MaxBidiStreamNum: 5,
MaxUniStreamNum: 6,
ActiveConnectionIDLimit: 7,
MaxDatagramFrameSize: 1000,
}
BeforeEach(func() {
@ -699,6 +713,16 @@ var _ = Describe("Transport Parameters", func() {
p.ActiveConnectionIDLimit = saved.ActiveConnectionIDLimit + 1
Expect(p.ValidForUpdate(saved)).To(BeTrue())
})
It("rejects the parameters if the MaxDatagramFrameSize reduced", func() {
p.MaxDatagramFrameSize = saved.MaxDatagramFrameSize - 1
Expect(p.ValidForUpdate(saved)).To(BeFalse())
})
It("doesn't reject the parameters if the MaxDatagramFrameSize increased", func() {
p.MaxDatagramFrameSize = saved.MaxDatagramFrameSize + 1
Expect(p.ValidForUpdate(saved)).To(BeTrue())
})
})
})
})