forked from quic-go/quic-go
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:
@@ -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() {
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user