From 4bf55a99ede37ee6112833ec234914010ab6337d Mon Sep 17 00:00:00 2001 From: tobyxdd Date: Mon, 29 Dec 2025 19:24:30 -0800 Subject: [PATCH] fix: logic issues with BBR impl --- core/internal/congestion/bbr/bandwidth_sampler.go | 2 +- core/internal/congestion/bbr/bbr_sender.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/internal/congestion/bbr/bandwidth_sampler.go b/core/internal/congestion/bbr/bandwidth_sampler.go index 0e770f1..f140894 100644 --- a/core/internal/congestion/bbr/bandwidth_sampler.go +++ b/core/internal/congestion/bbr/bandwidth_sampler.go @@ -199,7 +199,7 @@ func (m *maxAckHeightTracker) Update( // Compute how many extra bytes were delivered vs max bandwidth. extraBytesAcked := m.aggregationEpochBytes - expectedBytesAcked newEvent := extraAckedEvent{ - extraAcked: expectedBytesAcked, + extraAcked: extraBytesAcked, bytesAcked: m.aggregationEpochBytes, timeDelta: aggregationDelta, } diff --git a/core/internal/congestion/bbr/bbr_sender.go b/core/internal/congestion/bbr/bbr_sender.go index f5bf834..695bb9f 100644 --- a/core/internal/congestion/bbr/bbr_sender.go +++ b/core/internal/congestion/bbr/bbr_sender.go @@ -23,7 +23,7 @@ import ( // const ( - minBps = 65536 // 64 kbps + minBps = 65536 // 64 KB/s invalidPacketNumber = -1 initialCongestionWindowPackets = 32 @@ -553,7 +553,7 @@ func (b *bbrSender) bandwidthEstimate() Bandwidth { } func (b *bbrSender) bandwidthForPacer() congestion.ByteCount { - bps := congestion.ByteCount(float64(b.bandwidthEstimate()) * b.congestionWindowGain / float64(BytesPerSecond)) + bps := congestion.ByteCount(float64(b.PacingRate()) / float64(BytesPerSecond)) if bps < minBps { // We need to make sure that the bandwidth value for pacer is never zero, // otherwise it will go into an edge case where HasPacingBudget = false