fix auto-tuning of connection-level flow control window

fixes #424
This commit is contained in:
Marten Seemann
2017-02-17 19:47:09 +07:00
parent a5774dcfd9
commit 0d6647ed8c
2 changed files with 12 additions and 0 deletions

View File

@@ -184,6 +184,7 @@ func (c *flowController) maybeAdjustWindowIncrement() {
func (c *flowController) EnsureMinimumWindowIncrement(inc protocol.ByteCount) {
if inc > c.receiveWindowIncrement {
c.receiveWindowIncrement = utils.MinByteCount(inc, c.maxReceiveWindowIncrement)
c.lastWindowUpdateTime = time.Time{} // disables autotuning for the next window update
}
}

View File

@@ -352,6 +352,17 @@ var _ = Describe("Flow controller", func() {
controller.EnsureMinimumWindowIncrement(2 * max)
Expect(controller.receiveWindowIncrement).To(Equal(max))
})
It("doesn't auto-tune the window after the increment was increased", func() {
setRtt(10 * time.Millisecond)
controller.bytesRead = 9900 // receive window is 10000
controller.lastWindowUpdateTime = time.Now().Add(-10 * time.Millisecond)
controller.EnsureMinimumWindowIncrement(912)
necessary, newIncrement, offset := controller.MaybeUpdateWindow()
Expect(necessary).To(BeTrue())
Expect(newIncrement).To(BeZero()) // no auto-tuning
Expect(offset).To(Equal(protocol.ByteCount(9900 + 912)))
})
})
})
})