store in flow controller if a stream contributes to connection flow control

This commit is contained in:
Marten Seemann
2017-02-08 11:48:13 +07:00
parent db11b25790
commit 291e6c1344
4 changed files with 49 additions and 47 deletions

View File

@@ -11,7 +11,8 @@ import (
)
type flowController struct {
streamID protocol.StreamID
streamID protocol.StreamID
contributesToConnection bool // does the stream contribute to connection level flow control
connectionParameters handshake.ConnectionParametersManager
rttStats *congestion.RTTStats
@@ -32,11 +33,12 @@ type flowController struct {
var ErrReceivedSmallerByteOffset = errors.New("Received a smaller byte offset")
// newFlowController gets a new flow controller
func newFlowController(streamID protocol.StreamID, connectionParameters handshake.ConnectionParametersManager, rttStats *congestion.RTTStats) *flowController {
func newFlowController(streamID protocol.StreamID, contributesToConnection bool, connectionParameters handshake.ConnectionParametersManager, rttStats *congestion.RTTStats) *flowController {
fc := flowController{
streamID: streamID,
connectionParameters: connectionParameters,
rttStats: rttStats,
streamID: streamID,
contributesToConnection: contributesToConnection,
connectionParameters: connectionParameters,
rttStats: rttStats,
}
if streamID == 0 {
@@ -52,6 +54,10 @@ func newFlowController(streamID protocol.StreamID, connectionParameters handshak
return &fc
}
func (c *flowController) ContributesToConnection() bool {
return c.contributesToConnection
}
func (c *flowController) getSendWindow() protocol.ByteCount {
if c.sendWindow == 0 {
if c.streamID == 0 {