forked from quic-go/quic-go
always queue window updates when data is being read
There's no need to have a separate call in the flow controller interface for this.
This commit is contained in:
@@ -13,18 +13,16 @@ import (
|
||||
|
||||
var _ = Describe("Stream Flow controller", func() {
|
||||
var (
|
||||
controller *streamFlowController
|
||||
queuedWindowUpdate bool
|
||||
queuedConnWindowUpdate bool
|
||||
controller *streamFlowController
|
||||
queuedWindowUpdate bool
|
||||
)
|
||||
|
||||
BeforeEach(func() {
|
||||
queuedWindowUpdate = false
|
||||
queuedConnWindowUpdate = false
|
||||
rttStats := &congestion.RTTStats{}
|
||||
controller = &streamFlowController{
|
||||
streamID: 10,
|
||||
connection: NewConnectionFlowController(1000, 1000, func() { queuedConnWindowUpdate = true }, rttStats, utils.DefaultLogger).(*connectionFlowController),
|
||||
connection: NewConnectionFlowController(1000, 1000, func() {}, rttStats, utils.DefaultLogger).(*connectionFlowController),
|
||||
}
|
||||
controller.maxReceiveWindowSize = 10000
|
||||
controller.rttStats = rttStats
|
||||
@@ -57,7 +55,6 @@ var _ = Describe("Stream Flow controller", func() {
|
||||
cc := NewConnectionFlowController(0, 0, nil, nil, utils.DefaultLogger)
|
||||
fc := NewStreamFlowController(5, cc, receiveWindow, maxReceiveWindow, sendWindow, queueWindowUpdate, rttStats, utils.DefaultLogger).(*streamFlowController)
|
||||
fc.AddBytesRead(receiveWindow)
|
||||
fc.MaybeQueueWindowUpdate()
|
||||
Expect(queued).To(BeTrue())
|
||||
})
|
||||
})
|
||||
@@ -179,25 +176,16 @@ var _ = Describe("Stream Flow controller", func() {
|
||||
})
|
||||
|
||||
It("queues window updates", func() {
|
||||
controller.MaybeQueueWindowUpdate()
|
||||
controller.AddBytesRead(1)
|
||||
Expect(queuedWindowUpdate).To(BeFalse())
|
||||
controller.AddBytesRead(30)
|
||||
controller.MaybeQueueWindowUpdate()
|
||||
controller.AddBytesRead(29)
|
||||
Expect(queuedWindowUpdate).To(BeTrue())
|
||||
Expect(controller.GetWindowUpdate()).ToNot(BeZero())
|
||||
queuedWindowUpdate = false
|
||||
controller.MaybeQueueWindowUpdate()
|
||||
controller.AddBytesRead(1)
|
||||
Expect(queuedWindowUpdate).To(BeFalse())
|
||||
})
|
||||
|
||||
It("queues connection-level window updates", func() {
|
||||
controller.MaybeQueueWindowUpdate()
|
||||
Expect(queuedConnWindowUpdate).To(BeFalse())
|
||||
controller.AddBytesRead(60)
|
||||
controller.MaybeQueueWindowUpdate()
|
||||
Expect(queuedConnWindowUpdate).To(BeTrue())
|
||||
})
|
||||
|
||||
It("tells the connection flow controller when the window was autotuned", func() {
|
||||
oldOffset := controller.bytesRead
|
||||
setRtt(scaleDuration(20 * time.Millisecond))
|
||||
@@ -211,10 +199,8 @@ var _ = Describe("Stream Flow controller", func() {
|
||||
})
|
||||
|
||||
It("doesn't increase the window after a final offset was already received", func() {
|
||||
Expect(controller.UpdateHighestReceived(90, true)).To(Succeed())
|
||||
controller.AddBytesRead(30)
|
||||
err := controller.UpdateHighestReceived(90, true)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
controller.MaybeQueueWindowUpdate()
|
||||
Expect(queuedWindowUpdate).To(BeFalse())
|
||||
offset := controller.GetWindowUpdate()
|
||||
Expect(offset).To(BeZero())
|
||||
|
||||
Reference in New Issue
Block a user