Skip to content

fix(sctp): correct PR-SCTP max_retransmits abandonment condition#78

Open
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:fix/sctp-max-retransmits
Open

fix(sctp): correct PR-SCTP max_retransmits abandonment condition#78
nightness wants to merge 1 commit intowebrtc-rs:masterfrom
Brainwires:fix/sctp-max-retransmits

Conversation

@nightness
Copy link
Copy Markdown

Summary

Fixes a one-off error in the PR-SCTP partial reliability abandonment check (closes webrtc-rs/webrtc#776).

  • Changed >= max_retransmits to > max_retransmits so a stream configured with max_retransmits(0) abandons the message only after the first failed delivery attempt, not immediately on the first attempt. Previously a max_retransmits(0) DataChannel would close after a single failed send even though it should remain open.

Test plan

  • cargo test -p rtc passes
  • DataChannel with max_retransmits(0) stays open after one failed delivery

…→ >)

Fixes webrtc-rs/webrtc#776.

RFC 3758 §5.3.1 specifies that a DATA chunk should be abandoned when it
has been transmitted MORE THAN max_retransmits times. The previous check
used `>=`, which abandoned chunks after only max_retransmits sends (one
fewer than the allowed total of max_retransmits + 1).

For example, with max_retransmits=1 (reliability_value=1):
  Before: abandon when nsent >= 1 → abandoned after first send (zero retransmits)
  After:  abandon when nsent  > 1 → abandoned after second send (one retransmit) ✓

With max_retransmits=0 (reliability_value=0), the behavior is identical
(nsent=1 satisfies both >= 0 and > 0 after the first send).

Premature abandonment was the root cause of channels unexpectedly closing:
the abandoned chunk triggered Forward TSN skip-ahead, which in some
browser interop scenarios caused the peer to reset the stream.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

RTCDataChannel transitions to Closed state after a single failed delivery with max_retransmits(0)

1 participant