set if a stream contributes to connection flow control

This depends on the version. In gQUIC, stream 1 and 3 don't contribute,
in IETF QUIC only stream 0 doesn't contribute.
This commit is contained in:
Marten Seemann
2017-11-01 14:32:03 +07:00
parent f662822486
commit 1f644debd4
3 changed files with 27 additions and 6 deletions

View File

@@ -68,6 +68,17 @@ func (vn VersionNumber) CryptoStreamID() StreamID {
return 0
}
// StreamContributesToConnectionFlowControl says if a stream contributes to connection-level flow control
func (vn VersionNumber) StreamContributesToConnectionFlowControl(id StreamID) bool {
if id == vn.CryptoStreamID() {
return false
}
if vn.isGQUIC() && id == 3 {
return false
}
return true
}
func (vn VersionNumber) isGQUIC() bool {
return vn > gquicVersion0 && vn <= maxGquicVersion
}