Skip to content

Implement 9260 ack and rtx timers - #518

Merged
JoTurk merged 1 commit into
mainfrom
jo/rfc9260-timers
Oct 1, 2026
Merged

JoTurk merged 1 commit into
mainfrom
jo/rfc9260-timers

Conversation

@JoTurk

@JoTurk JoTurk commented Oct 1, 2026

Copy link
Copy Markdown
Member

Description

Folds: #403 and #429

on top of them it actually integrates the timers, makes the backoff reset actually work, fixes SACK
ordering, stops T3 after validation simplifies the code and removes unused helpers that were added
in the original PRs.

Reference issue

closes #428

Folds:
#403
#429

on top of them it actually integerates the timers,
makes the backoff reset actually work, fixes SACK
ordering, stops T3 after validation simplifes the
code and removes unused helpers that were added
in the original PRs.

closes: #428

Co-authored-by: philipch07 <philipch07@gmail.com>
@codecov

codecov Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.22222% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.47%. Comparing base (e1fbf8b) to head (a5a8fe0).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
association.go 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #518      +/-   ##
==========================================
+ Coverage   89.04%   89.47%   +0.43%     
==========================================
  Files          56       56              
  Lines        4756     4770      +14     
==========================================
+ Hits         4235     4268      +33     
+ Misses        521      502      -19     
Flag Coverage Δ
go 89.47% <97.22%> (+0.43%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JoTurk
JoTurk requested a review from Ibn-Butt-Toota October 1, 2026 00:27
Comment thread association.go
Comment on lines +3031 to +3045
// measureRTT applies RFC 9260 section 6.3.1 C4/C5: sample once per round trip
// and exclude retransmitted DATA (Karn's algorithm). The caller holds the lock.
func (a *Association) measureRTT(c *chunkPayloadData, now time.Time) {
if c.nSent != 1 || sna32LT(c.tsn, a.minTSN2MeasureRTT) {
return
}
a.minTSN2MeasureRTT = a.myNextTSN
rtt := now.Sub(c.since)
srtt := a.rtoMgr.setNewRTT(rtt.Seconds() * 1000)
a.srtt.Store(srtt)
// Keep a windowed minimum so RACK can adapt when the path RTT changes.
a.rack.rackMinRTTWnd.Push(now, rtt)
a.log.Tracef("[%s] SACK: measured-rtt=%f srtt=%f new-rto=%f",
a.name, rtt.Seconds()*1000, srtt, a.rtoMgr.getRTO())
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice, we needed to pull this out a long time ago. Maybe it can even be in a helper for the v2.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh i didn't write this lol, this was just refactored from main from two places from processSelectiveAck, I just made it into a helper :)

sctp/association.go

Lines 2972 to 2992 in e1fbf8b

// C5) Karn's algorithm: RTT measurements MUST NOT be made using
// packets that were retransmitted (and thus for which it is
// ambiguous whether the reply was for the first instance of the
// chunk or for a later instance)
if sna32GTE(chunkPayload.tsn, a.minTSN2MeasureRTT) {
// Only original transmissions for classic RTT measurement (Karn's rule)
if chunkPayload.nSent == 1 {
a.minTSN2MeasureRTT = a.myNextTSN
rtt := now.Sub(chunkPayload.since).Seconds() * 1000.0
srtt := a.rtoMgr.setNewRTT(rtt)
a.srtt.Store(srtt)
// use a window to determine minRtt instead of a global min
// as the RTT can fluctuate, which can cause problems if going from a
// high RTT to a low RTT.
a.rack.rackMinRTTWnd.Push(now, now.Sub(chunkPayload.since))
a.log.Tracef("[%s] SACK: measured-rtt=%f srtt=%f new-rto=%f",
a.name, rtt, srtt, a.rtoMgr.getRTO())
}
}

Comment thread association.go
Comment on lines +4644 to +4646
if a.ackState != ackStateDelay {
return
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops looks like we forgot to wire this up. Thanks for catching it!

@JoTurk
JoTurk merged commit a5a8fe0 into main Oct 1, 2026
20 checks passed
@JoTurk
JoTurk deleted the jo/rfc9260-timers branch October 1, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update ack_timer to RFC 9260

2 participants