implement the MAX_DATA and MAX_STREAM_DATA frames

For gQUIC WINDOW_UPDATEs are converted to MAX_DATA and MAX_STREAM_DATA,
respectively.
This commit is contained in:
Marten Seemann
2017-11-01 15:29:15 +07:00
parent ccb2e9a2df
commit 0f1f1c8d41
18 changed files with 512 additions and 168 deletions

View File

@@ -68,6 +68,11 @@ func (vn VersionNumber) CryptoStreamID() StreamID {
return 0
}
// UsesMaxDataFrame tells if this version uses MAX_DATA, MAX_STREAM_DATA, BLOCKED and STREAM_BLOCKED instead of WINDOW_UDPATE and BLOCKED frames
func (vn VersionNumber) UsesMaxDataFrame() bool {
return vn.CryptoStreamID() == 0
}
// StreamContributesToConnectionFlowControl says if a stream contributes to connection-level flow control
func (vn VersionNumber) StreamContributesToConnectionFlowControl(id StreamID) bool {
if id == vn.CryptoStreamID() {

View File

@@ -52,6 +52,13 @@ var _ = Describe("Version", func() {
Expect(VersionTLS.CryptoStreamID()).To(Equal(StreamID(0)))
})
It("tells if a version uses the MAX_DATA, MAX_STREAM_DATA, BLOCKED and STREAM_BLOCKED frames", func() {
Expect(Version37.UsesMaxDataFrame()).To(BeFalse())
Expect(Version38.UsesMaxDataFrame()).To(BeFalse())
Expect(Version39.UsesMaxDataFrame()).To(BeFalse())
Expect(VersionTLS.UsesMaxDataFrame()).To(BeTrue())
})
It("says if a stream contributes to connection-level flowcontrol, for gQUIC", func() {
Expect(Version39.StreamContributesToConnectionFlowControl(1)).To(BeFalse())
Expect(Version39.StreamContributesToConnectionFlowControl(2)).To(BeTrue())