Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions internal/cc/feedback_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ func (f *FeedbackAdapter) OnTransportCCFeedback(
}
}

// Discard padding slots from the last StatusVectorChunk.
if int(feedback.PacketStatusCount) < len(result) {
result = result[:feedback.PacketStatusCount]
}

return result, nil
}

Expand Down
14 changes: 3 additions & 11 deletions internal/cc/feedback_adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ func TestFeedbackAdapterTWCC(t *testing.T) {
assert.NoError(t, err)

assert.NotEmpty(t, results)
assert.Len(t, results, 7)
assert.Len(t, results, 2)
assert.Contains(t, results, Acknowledgment{
SequenceNumber: 65535,
Size: pkt65535.Header.MarshalSize() + 1200,
Expand Down Expand Up @@ -739,7 +739,7 @@ func TestFeedbackAdapterTWCC(t *testing.T) {
},
})
assert.NoError(t, err)
assert.Len(t, results, 7)
assert.Len(t, results, 3)
for i := range uint16(3) {
assert.Contains(t, results, Acknowledgment{
SequenceNumber: i,
Expand All @@ -748,14 +748,6 @@ func TestFeedbackAdapterTWCC(t *testing.T) {
Arrival: t0.Add(time.Duration((i + 1)) * 4 * time.Microsecond),
})
}
for i := uint16(3); i < 7; i++ {
assert.Contains(t, results, Acknowledgment{
SequenceNumber: i,
Size: headers[i].MarshalSize() + 1200,
Departure: t0,
Arrival: time.Time{},
})
}
})

t.Run("runLengthChunk", func(t *testing.T) {
Expand Down Expand Up @@ -858,7 +850,7 @@ func TestFeedbackAdapterTWCC(t *testing.T) {
})

assert.NoError(t, err)
assert.Len(t, packets, 14)
assert.Len(t, packets, 3)
})

t.Run("mixedRunLengthAndStatusVector", func(t *testing.T) {
Expand Down
Loading