recovery: don't let receiver traffic refresh a link awaiting REG3 - #19
Merged
Merged
Conversation
A link that was established and is put into recovery (send failure, failed socket rebuild) has `connected = false` until REG3 re-admits it, and relies on `is_timed_out` to drive housekeeping's socket rebuild and REG2. If the interface returns quickly, the receiver's SRT ACK/NAKs for that address arrive on the still-open socket and refresh `last_received`; housekeeping then treats the link as alive, sends it keepalives whose replies keep refreshing it, and never re-registers it. The link carries no data (not connected) until the receiver gives up on it, which on a macOS USB tether replugged for 500 ms took 15-20 s — far past the SRT peer-idle timeout. Only refresh `last_received` on non-registration traffic for a link that is connected or has never been established, so a recovering link stays on the timeout-driven reconnect path until REG3.
Contributor
|
Warning Review limit reachedNext included review available in 59 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: irlserver/srtla_send/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Member
|
Thanks! Will also look into your other commit, but it may take longer to review as it is more code to look at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this matters to you
This is the same symptom as #18 (fast reconnect retry): a sub-second tether or modem blip becomes a full SRT
session drop and many seconds of black at the receiver. This time the retry timing is not
the cause, so it happens even when the interface is back in under half a second. The link just
sits there carrying nothing for 15–20 s. Because it depends on timing, it looks intermittent:
"sometimes a tiny blip kills the stream".
The cause: while a link is in recovery, traffic arriving from the receiver makes it look alive
again. srtla_send therefore never re-registers it, even though it is not being used for data.
With this PR, a recovering link keeps going through rebind + REG2 until REG3 re-admits it. The
link is back within about 1–3 s of the interface returning. Nothing changes for connected links
or for initial registration.
Problem
Here is the sequence:
flush_connection→recover_connection), or a socket rebuild fails.mark_for_recoveryclearsconnectedandlast_received. Housekeeping should then rebuildthe socket and re-send REG2 until REG3.
the still-open socket.
process_uplink_packetsetslast_received = nowfor every non-registration packet, so thelink no longer counts as timed out.
the link, while
connected == falsekeeps the scheduler off it.Change
In
uplink_recv.rs, non-registration traffic refresheslast_receivedonly when the link isconnectedor has never been established. Initial registration keeps its existing handling.REG3 still sets
connectedandlast_receivedas before.Tests
src/tests/recovery_limbo_tests.rs:is_timed_outafter receiving an SRT ACK,and after receiving a keepalive reply. Both of these fail without the change.
Field evidence
Same setup as #18. With #18 alone, 3 of 6 cuts still ended the session. On those cuts macOS
had the tether's link and address back at +0.38 s, but the next reconnect attempt on the tether
came at +18–23 s. With both #18 and this PR, all 30 cuts were hitless, and the tether went from link back to
connection establishedin 1.0–3.0 s.Independent of #18: this branch is v4.0.1 plus this one commit and applies on its own.