Repository navigation
Track synchronisation universes separately from data universes - #91
Open
stewartadam wants to merge 1 commit into
Open
stewartadam wants to merge 1 commit into
stewartadam wants to merge 1 commit into
Conversation
A data packet with a sync address made the receiver call listen_universes for that address. That joined its multicast group, which is needed for the sync packets, but also added it to the user's data universes, so data sent on the sync universe was passed up although the user never listened to it, and the group was never left. Sync addresses are now kept in their own map with the time each was last named. Their groups are joined without adding them to the data universes, and left once no data packet has named them for the data loss timeout. listen_universes and mute_universe account for a group that is also in use for synchronisation, so it isn't joined twice or left early. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KzaQVPkrkczgX2g7wGkip5
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.
Problem
When a data packet names a synchronisation address S, the receiver called
listen_universes(&[S]). Joining S's multicast group is right, because the sync packets arrive there. Butlisten_universesalso adds S to the universes the user asked for, which had three side effects:igmp_max_memberships, 20 by default), so a network that cycles through many sync addresses eventually makes the join fail, and that error came back fromrecvfor every such packet.Change
sync_universes: HashMap<u16, Instant>onSacnReceiver. It records each sync address named by a data packet and when it was last named.handle_data_packetcalls a newtrack_sync_universe. That joins the group (if it isn't already joined, multicast is enabled, and the user isn't already listening to S) and refreshes the timestamp. S is not added to the data universes.handle_sync_packetaccepts sync packets for universes the user listens to or that are insync_universes.recvnow callsexpire_sync_universesnext to the existing waiting-data timeout check. It drops sync universes that haven't been named forE131_NETWORK_DATA_LOSS_TIMEOUT, and leaves their group unless the user listens to that universe.listen_universesdoesn't join a group already joined for sync, since a second join fails withEADDRINUSEon Linux.mute_universedoesn't leave a group still needed for sync.Dropalso leaves the groups joined only for sync.Behaviour change: data sent on a universe that is only used as a sync address is no longer delivered unless the application listens to that universe.
Tests
Three unit tests in
receive.rs:AddrInUsewithout thelisten_universesguard. Its last assertion relies on leaving an unjoined group erroring, so it's skipped on Windows.cargo test --libpasses. The#[ignore]d sync integration tests intests/ipv4_tests.rsneed specific LAN addresses, so I ran them with those addresses switched to loopback (not committed). All 11 pass.