diff --git a/flowcontrol/flow_controller.go b/flowcontrol/flow_controller.go index 928438e6..6a0d3855 100644 --- a/flowcontrol/flow_controller.go +++ b/flowcontrol/flow_controller.go @@ -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 } } diff --git a/flowcontrol/flow_controller_test.go b/flowcontrol/flow_controller_test.go index b496526f..1c822997 100644 --- a/flowcontrol/flow_controller_test.go +++ b/flowcontrol/flow_controller_test.go @@ -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))) + }) }) }) })