forked from quic-go/quic-go
fix receive flow control windows diverging
This commit is contained in:
@@ -102,8 +102,8 @@ func (c *flowController) MaybeTriggerWindowUpdate() (bool, protocol.ByteCount) {
|
|||||||
diff := c.receiveFlowControlWindow - c.bytesRead
|
diff := c.receiveFlowControlWindow - c.bytesRead
|
||||||
// Chromium implements the same threshold
|
// Chromium implements the same threshold
|
||||||
if diff < (c.receiveFlowControlWindowIncrement / 2) {
|
if diff < (c.receiveFlowControlWindowIncrement / 2) {
|
||||||
c.receiveFlowControlWindow += c.receiveFlowControlWindowIncrement
|
c.receiveFlowControlWindow = c.bytesRead + c.receiveFlowControlWindowIncrement
|
||||||
return true, c.bytesRead + c.receiveFlowControlWindowIncrement
|
return true, c.receiveFlowControlWindow
|
||||||
}
|
}
|
||||||
return false, 0
|
return false, 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ var _ = Describe("Flow controller", func() {
|
|||||||
updateNecessary, offset := controller.MaybeTriggerWindowUpdate()
|
updateNecessary, offset := controller.MaybeTriggerWindowUpdate()
|
||||||
Expect(updateNecessary).To(BeTrue())
|
Expect(updateNecessary).To(BeTrue())
|
||||||
Expect(offset).To(Equal(readPosition + receiveFlowControlWindowIncrement))
|
Expect(offset).To(Equal(readPosition + receiveFlowControlWindowIncrement))
|
||||||
|
Expect(controller.receiveFlowControlWindow).To(Equal(readPosition + receiveFlowControlWindowIncrement))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("triggers a window update when not necessary", func() {
|
It("triggers a window update when not necessary", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user