Skip to content

Commit 98872a4

Browse files
authored
Merge pull request #1495 from apernet/dev/bbr-fix
fix: logic issues with BBR impl
2 parents 001eaa2 + c57f9c7 commit 98872a4

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

.github/workflows/master.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
runs-on: ubuntu-latest
1212
env:
1313
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
14+
outputs:
15+
files: ${{ steps.list-files.outputs.files }}
1416

1517
steps:
1618
- name: Check out
@@ -45,8 +47,35 @@ jobs:
4547
sha256sum $file >> build/hashes.txt
4648
done
4749
48-
- name: Archive
50+
- name: List build files
51+
id: list-files
52+
run: |
53+
files=$(ls -1 build/ | jq -R -s -c 'split("\n") | map(select(length > 0))')
54+
echo "files=$files" >> $GITHUB_OUTPUT
55+
56+
- name: Upload build directory
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: build-temp-${{ github.sha }}
60+
path: build/
61+
retention-days: 1
62+
63+
upload:
64+
name: Upload ${{ matrix.file }}
65+
needs: build
66+
runs-on: ubuntu-latest
67+
strategy:
68+
fail-fast: false
69+
matrix:
70+
file: ${{ fromJson(needs.build.outputs.files) }}
71+
steps:
72+
- name: Download build
73+
uses: actions/download-artifact@v4
74+
with:
75+
name: build-temp-${{ github.sha }}
76+
77+
- name: Upload ${{ matrix.file }}
4978
uses: actions/upload-artifact@v4
5079
with:
51-
name: hysteria-master-${{ github.sha }}
52-
path: build
80+
name: ${{ matrix.file }}
81+
path: ${{ matrix.file }}

core/internal/congestion/bbr/bandwidth_sampler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func (m *maxAckHeightTracker) Update(
199199
// Compute how many extra bytes were delivered vs max bandwidth.
200200
extraBytesAcked := m.aggregationEpochBytes - expectedBytesAcked
201201
newEvent := extraAckedEvent{
202-
extraAcked: expectedBytesAcked,
202+
extraAcked: extraBytesAcked,
203203
bytesAcked: m.aggregationEpochBytes,
204204
timeDelta: aggregationDelta,
205205
}

core/internal/congestion/bbr/bbr_sender.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
//
2424

2525
const (
26-
minBps = 65536 // 64 kbps
26+
minBps = 65536 // 64 KB/s
2727

2828
invalidPacketNumber = -1
2929
initialCongestionWindowPackets = 32
@@ -553,7 +553,7 @@ func (b *bbrSender) bandwidthEstimate() Bandwidth {
553553
}
554554

555555
func (b *bbrSender) bandwidthForPacer() congestion.ByteCount {
556-
bps := congestion.ByteCount(float64(b.bandwidthEstimate()) * b.congestionWindowGain / float64(BytesPerSecond))
556+
bps := congestion.ByteCount(float64(b.PacingRate()) / float64(BytesPerSecond))
557557
if bps < minBps {
558558
// We need to make sure that the bandwidth value for pacer is never zero,
559559
// otherwise it will go into an edge case where HasPacingBudget = false

0 commit comments

Comments
 (0)