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
|
||||
// Chromium implements the same threshold
|
||||
if diff < (c.receiveFlowControlWindowIncrement / 2) {
|
||||
c.receiveFlowControlWindow += c.receiveFlowControlWindowIncrement
|
||||
return true, c.bytesRead + c.receiveFlowControlWindowIncrement
|
||||
c.receiveFlowControlWindow = c.bytesRead + c.receiveFlowControlWindowIncrement
|
||||
return true, c.receiveFlowControlWindow
|
||||
}
|
||||
return false, 0
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ var _ = Describe("Flow controller", func() {
|
||||
updateNecessary, offset := controller.MaybeTriggerWindowUpdate()
|
||||
Expect(updateNecessary).To(BeTrue())
|
||||
Expect(offset).To(Equal(readPosition + receiveFlowControlWindowIncrement))
|
||||
Expect(controller.receiveFlowControlWindow).To(Equal(readPosition + receiveFlowControlWindowIncrement))
|
||||
})
|
||||
|
||||
It("triggers a window update when not necessary", func() {
|
||||
|
||||
Reference in New Issue
Block a user