fix(srtla-core): retry a timed-out link every second before slowing down - #22
Merged
Merged
Conversation
SRT drops the session after 5 s of silence, so the first retry of an established link came too late for a sub-second blip (bumped USB cable, modem re-attach). The first 4 attempts now run 1 s apart, matching the C sender's housekeeping cadence, then every 5 s. A successful socket rebuild reset the attempt count, so the backoff ladder never climbed while the local bind worked and a dead path retried at a flat 5 s. Only REG3 resets the count now. The ladder is gone: with a working count it would leave a link that recovers after a few minutes waiting up to 2 minutes more. Retries allow half a tick of slack. Each attempt is stamped when its tick was serviced, so a strict 1000 ms check missed by a few ms whenever one tick ran late, and the retry slipped a whole tick. Co-authored-by: Simon <simonaverhoeven@gmail.com>
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.
Supersedes #18. It keeps the fast retry window from that PR, drops its config knobs, and fixes the retry count reset that kept the window from working as described.
Why
SRT drops the session after 5 s of silence. An established link that timed out got its first retry 5 s later, so a sub-second blip (a bumped USB cable, a modem re-attaching) could cost the whole SRT session.
Changes
rebuild_uplink_socketused to reset it after every successful bind. That meant the count only climbed when the bind failed. A link with a dead path and a live interface retried at a flat 5 s, and with reconnect: retry at housekeeping cadence before backing off (match C srtla_send) #18 applied it would have retried at 1 s forever.>= 1000check, a tick that ran a few ms late pushed the retry a whole second later. Initial registration had the same edge and gets the same slack.msknob in reconnect: retry at housekeeping cadence before backing off (match C srtla_send) #18 could only take the values 1 to 5 s, and nobody asked for the attempt count to be tunable.--conn-timeout-msand the retry pacing.Review notes
crates/srtla-core/src/connection/reconnection.rs, then the one-line removals insrc/sender/connections.rsandconnection/mod.rs.rebuild_uplink_socket. After a re-home, links keep their attempt count and retry every 5 s. That matches their pacing before this change.Summary by CodeRabbit