Judge loss by arrival order and a deadline, one tx ring per stream

This commit is contained in:
flamingcow
2026-08-31 14:33:09 -07:00
parent 06fa759b1a
commit 7fa48da73c
12 changed files with 220 additions and 254 deletions
+4 -4
View File
@@ -44,7 +44,7 @@ func TestRxBucketWraps(t *testing.T) {
// complete across the board and the rate comes from the window behind the
// lowest frontier.
func TestDirectionRateReadsOneBucketBack(t *testing.T) {
d := &direction{rxStats: []*rxStats{{}, {}}}
d := &direction{masked: &atomic.Bool{}, rxStats: []*rxStats{{}, {}}}
d.rxStats[0].commit(1, 1, 500)
d.rxStats[1].commit(1, 1, 700)
d.rxStats[0].commit(2, 1, 900)
@@ -61,7 +61,7 @@ func TestDirectionRateReadsOneBucketBack(t *testing.T) {
// stream still short of the epoch holds the read back rather than having its
// half-filled bucket summed.
func TestDirectionRateWaitsForSlowestStream(t *testing.T) {
d := &direction{rxStats: []*rxStats{{}, {}}}
d := &direction{masked: &atomic.Bool{}, rxStats: []*rxStats{{}, {}}}
d.rxStats[0].commit(1, 1, 500)
d.rxStats[0].commit(2, 1, 900)
@@ -95,7 +95,7 @@ func TestDirectionRateWaitsForSlowestStream(t *testing.T) {
// An epoch only advances when a frame is read, so a frontier that stops moving
// is a quiet wire and must not keep reporting the last bucket.
func TestDirectionRateGoesStale(t *testing.T) {
d := &direction{rxStats: []*rxStats{{}}}
d := &direction{masked: &atomic.Bool{}, rxStats: []*rxStats{{}}}
d.rxStats[0].commit(1, 1, 500)
d.rxStats[0].commit(2, 1, 900)
@@ -123,7 +123,7 @@ func settleAll(frames, bytes []uint64) {
// the raw ring per sample and displayed the excess again — 2C here, and >20G
// on the wire.
func TestDirectionRateNeverRedisplaysDonatedExcess(t *testing.T) {
d := &direction{rxStats: []*rxStats{{}}}
d := &direction{masked: &atomic.Bool{}, rxStats: []*rxStats{{}}}
c := bucketWireCap
seq := []uint64{c, 0, 2 * c, c, c, c, c, c}
now := time.Now()