Skip to content

Commit

Permalink
Increment missing indications from SACK
Browse files Browse the repository at this point in the history
Increment missing indication for reported
missing chunks instead of all inflight chunks.
  • Loading branch information
cnderrauber committed Nov 14, 2024
1 parent 943ac50 commit 5f604a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions association.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ func (a *Association) Close() error {
a.log.Debugf("[%s] stats nPackets (out) : %d", a.name, a.stats.getNumPacketsSent())
a.log.Debugf("[%s] stats nDATAs (in) : %d", a.name, a.stats.getNumDATAs())
a.log.Debugf("[%s] stats nSACKs (in) : %d", a.name, a.stats.getNumSACKsReceived())
a.log.Debugf("[%s] stats nSACKs (out) : %d\n", a.name, a.stats.getNumSACKsSent())
a.log.Debugf("[%s] stats nSACKs (out) : %d", a.name, a.stats.getNumSACKsSent())
a.log.Debugf("[%s] stats nT3Timeouts : %d", a.name, a.stats.getNumT3Timeouts())
a.log.Debugf("[%s] stats nAckTimeouts: %d", a.name, a.stats.getNumAckTimeouts())
a.log.Debugf("[%s] stats nFastRetrans: %d", a.name, a.stats.getNumFastRetrans())
Expand Down Expand Up @@ -1728,7 +1728,7 @@ func (a *Association) onCumulativeTSNAckPointAdvanced(totalBytesAcked int) {
}

// The caller should hold the lock.
func (a *Association) processFastRetransmission(cumTSNAckPoint, htna uint32, cumTSNAckPointAdvanced bool) error {
func (a *Association) processFastRetransmission(cumTSNAckPoint uint32, gapAckBlocks []gapAckBlock, htna uint32, cumTSNAckPointAdvanced bool) error {
// HTNA algorithm - RFC 4960 Sec 7.2.4
// Increment missIndicator of each chunks that the SACK reported missing
// when either of the following is met:
Expand All @@ -1745,7 +1745,10 @@ func (a *Association) processFastRetransmission(cumTSNAckPoint, htna uint32, cum
maxTSN = htna
} else {
// b) increment for all TSNs reported missing
maxTSN = cumTSNAckPoint + uint32(a.inflightQueue.size()) + 1
maxTSN = cumTSNAckPoint
if len(gapAckBlocks) > 0 {
maxTSN += uint32(gapAckBlocks[len(gapAckBlocks)-1].end)
}

Check warning on line 1751 in association.go

View check run for this annotation

Codecov / codecov/patch

association.go#L1748-L1751

Added lines #L1748 - L1751 were not covered by tests
}

for tsn := cumTSNAckPoint + 1; sna32LT(tsn, maxTSN); tsn++ {
Expand Down Expand Up @@ -1855,7 +1858,7 @@ func (a *Association) handleSack(d *chunkSelectiveAck) error {
a.setRWND(d.advertisedReceiverWindowCredit - bytesOutstanding)
}

err = a.processFastRetransmission(d.cumulativeTSNAck, htna, cumTSNAckPointAdvanced)
err = a.processFastRetransmission(d.cumulativeTSNAck, d.gapAckBlocks, htna, cumTSNAckPointAdvanced)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions association_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3489,10 +3489,10 @@ func TestAssociation_OpenStreamAfterInternalClose(t *testing.T) {
require.NoError(t, a2.netConn.Close())

_, err = a1.OpenStream(1, PayloadTypeWebRTCString)
require.NoError(t, err)
require.True(t, err == nil || errors.Is(err, ErrAssociationClosed))

_, err = a2.OpenStream(1, PayloadTypeWebRTCString)
require.NoError(t, err)
require.True(t, err == nil || errors.Is(err, ErrAssociationClosed))

require.NoError(t, a1.Close())
require.NoError(t, a2.Close())
Expand Down

0 comments on commit 5f604a4

Please sign in to comment.