forked from quic-go/quic-go
send MAX_{STREAM}_DATA frames more frequently
WINDOW_UPDATEs are relatively small, and it doesn't cost much to grant the peer more flow control credit earlier.
This commit is contained in:
@@ -67,9 +67,9 @@ func (c *baseFlowController) AddBytesRead(n protocol.ByteCount) {
|
||||
// getWindowUpdate updates the receive window, if necessary
|
||||
// it returns the new offset
|
||||
func (c *baseFlowController) getWindowUpdate() protocol.ByteCount {
|
||||
diff := c.receiveWindow - c.bytesRead
|
||||
// update the window when more than half of it was already consumed
|
||||
if diff >= (c.receiveWindowIncrement / 2) {
|
||||
bytesRemaining := c.receiveWindow - c.bytesRead
|
||||
// update the window when more than the threshold was consumed
|
||||
if bytesRemaining >= protocol.ByteCount((float64(c.receiveWindowIncrement) * float64((1 - protocol.WindowUpdateThreshold)))) {
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -86,7 +86,8 @@ func (c *baseFlowController) IsBlocked() bool {
|
||||
return c.sendWindowSize() == 0
|
||||
}
|
||||
|
||||
// maybeAdjustWindowIncrement increases the receiveWindowIncrement if we're sending WindowUpdates too often
|
||||
// maybeAdjustWindowIncrement increases the receiveWindowIncrement if we're sending updates too often.
|
||||
// For details about auto-tuning, see https://docs.google.com/document/d/1F2YfdDXKpy20WVKJueEf4abn_LVZHhMUMS5gX6Pgjl4/edit#heading=h.hcm2y5x4qmqt.
|
||||
func (c *baseFlowController) maybeAdjustWindowIncrement() {
|
||||
if c.lastWindowUpdateTime.IsZero() {
|
||||
return
|
||||
@@ -98,8 +99,8 @@ func (c *baseFlowController) maybeAdjustWindowIncrement() {
|
||||
}
|
||||
|
||||
timeSinceLastWindowUpdate := time.Since(c.lastWindowUpdateTime)
|
||||
// interval between the window updates is sufficiently large, no need to increase the increment
|
||||
if timeSinceLastWindowUpdate >= 2*rtt {
|
||||
// interval between the updates is sufficiently large, no need to increase the increment
|
||||
if timeSinceLastWindowUpdate >= 4*protocol.WindowUpdateThreshold*rtt {
|
||||
return
|
||||
}
|
||||
c.receiveWindowIncrement = utils.MinByteCount(2*c.receiveWindowIncrement, c.maxReceiveWindowIncrement)
|
||||
|
||||
Reference in New Issue
Block a user