refactor frame packing to logic to not access the streams map (#4596)

* avoid accessing the streams map when packing stream data

* avoid accessing the streams map when packing flow control frames

* remove streamGetter interface
This commit is contained in:
Marten Seemann
2024-07-28 12:32:54 -07:00
committed by GitHub
parent fc79a77ffe
commit 42f04d4e02
20 changed files with 224 additions and 390 deletions

View File

@@ -11,10 +11,7 @@ import (
)
var _ = Describe("Connection Flow controller", func() {
var (
controller *connectionFlowController
queuedWindowUpdate bool
)
var controller *connectionFlowController
// update the congestion such that it returns a given value for the smoothed RTT
setRtt := func(t time.Duration) {
@@ -23,11 +20,9 @@ var _ = Describe("Connection Flow controller", func() {
}
BeforeEach(func() {
queuedWindowUpdate = false
controller = &connectionFlowController{}
controller.rttStats = &utils.RTTStats{}
controller.logger = utils.DefaultLogger
controller.queueWindowUpdate = func() { queuedWindowUpdate = true }
controller.allowWindowIncrease = func(protocol.ByteCount) bool { return true }
})
@@ -41,7 +36,6 @@ var _ = Describe("Connection Flow controller", func() {
fc := NewConnectionFlowController(
receiveWindow,
maxReceiveWindow,
nil,
func(protocol.ByteCount) bool { return true },
rttStats,
utils.DefaultLogger).(*connectionFlowController)
@@ -67,13 +61,11 @@ var _ = Describe("Connection Flow controller", func() {
It("queues window updates", func() {
controller.AddBytesRead(1)
Expect(queuedWindowUpdate).To(BeFalse())
Expect(controller.GetWindowUpdate()).To(BeZero())
controller.AddBytesRead(29)
Expect(queuedWindowUpdate).To(BeTrue())
Expect(controller.GetWindowUpdate()).ToNot(BeZero())
queuedWindowUpdate = false
controller.AddBytesRead(1)
Expect(queuedWindowUpdate).To(BeFalse())
Expect(controller.GetWindowUpdate()).To(BeZero())
})
It("gets a window update", func() {