Repository navigation
Keep discovered sources for two discovery intervals - #79
Open
stewartadam wants to merge 1 commit into
Open
stewartadam wants to merge 1 commit into
stewartadam wants to merge 1 commit into
Conversation
UNIVERSE_DISCOVERY_SOURCE_TIMEOUT was the 2.5 s network data loss timeout, but sources only send universe discovery packets every E131_UNIVERSE_DISCOVERY_INTERVAL (10 s). get_discovered_sources dropped each source 2.5 s after its advert, so it was empty about three quarters of the time even though the source was still advertising. Use twice the discovery interval (20 s), so a source is only treated as lost after missing an advert. E1.31 doesn't define a receiver timeout, and the doc comment no longer cites one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KzaQVQThQpmqhvLapk99Vs
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.
Summary
UNIVERSE_DISCOVERY_SOURCE_TIMEOUTwas set toE131_NETWORK_DATA_LOSS_TIMEOUT(2.5 s). Sources only send universe discovery packets everyE131_UNIVERSE_DISCOVERY_INTERVAL(10 s, E1.31-2016 Appendix A). As a result,SacnReceiver::get_discovered_sources()dropped each source 2.5 s after its advert. It returned an empty list about 75% of the time, even though the source was still advertising.The timeout is now twice the discovery interval (20 s), so a source is only treated as lost after it misses a whole advert. The standard doesn't define a receiver-side timeout. The old doc comment cited one, and it now explains the reasoning instead.
Tests
test_discovered_source_kept_between_adverts: a source whose advert is 9.9 s old is still listed, and one older than the timeout is removed.cargo testandcargo clippypass, and clippy reports no new warnings. The ignored multicast discovery tests read discovered sources right after an advert, so the longer timeout doesn't affect them.