Skip to content

Support the Force_Synchronization option - #83

Open
stewartadam wants to merge 3 commits into
mainfrom
claude/project-thread-njq8b9-8-force-synchronization
Open

stewartadam wants to merge 3 commits into
mainfrom
claude/project-thread-njq8b9-8-force-synchronization

Conversation

@stewartadam

@stewartadam stewartadam commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

E1.31-2016 §6.2.6 and §11.1 describe two synchronisation behaviours (summarised in documentation/ANSI-E1.31-2018-Compliance-Check-List.pdf, where this was marked "Not implemented"):

  • Synchronisation on an address starts with the first sync packet (§11.1.1). It stops when no sync packet arrives within E131_NETWORK_DATA_LOSS_TIMEOUT (§11.1.2).
  • When synchronisation is lost, the Force_Synchronization option decides what happens. With 0, the receiver holds data until synchronisation resumes. With 1, the receiver may process data without waiting for a sync packet.

The receiver parsed the bit but never used it, so synchronised data was always held. SacnSource always sent the bit as 0.

Changes

Receiver

  • Records when the last sync packet arrived on each sync address.
  • A data packet that has a sync address, has Force_Synchronization set, and arrives while that address isn't synchronised (no sync packet within the timeout, or none yet) is now passed up immediately. It also replaces any data held for that universe.
  • The receiver still listens on the sync address, so synchronisation can resume.
  • Data without the option behaves exactly as before.

Source

  • New SacnSource::force_synchronization() and set_force_synchronization(bool) set the option on outgoing data packets. It defaults to false, so existing senders don't change.

Tests

  • New receiver unit tests:
    • test_force_synchronization_before_sync_starts
    • test_force_synchronization_while_synchronized (data is still held)
    • test_force_synchronization_after_sync_lost (with the bit unset, data is held; with it set, data passes)
  • New test_set_force_synchronization in tests/src_tests.rs.
  • Updated the doc comment on the ignored test_send_sync_timeout test, which said the option wasn't implemented.
  • cargo test and cargo clippy pass, and clippy reports no new warnings.

E1.31-2016 Section 6.2.6 and 11.1.2: when synchronisation on an address
is lost (no sync packet within E131_NETWORK_DATA_LOSS_TIMEOUT), a data
packet with Force_Synchronization set may be processed without waiting
for a sync packet, while one without it is held until synchronisation
resumes. The receiver parsed the bit but never used it, so synchronised
data was always held, and SacnSource always sent the bit as 0.

The receiver now records when it last got a sync packet on each sync
address. A data packet with Force_Synchronization set whose sync address
has had no sync packet within the timeout (or none yet, as per 11.1.1)
is passed up straight away. Without the option, behaviour is unchanged.

SacnSource gains force_synchronization/set_force_synchronization to set
the option on the data packets it sends. It defaults to off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KzaQVQThQpmqhvLapk99Vs
# Conflicts:
#	tests/src_tests.rs
The merge resolution dropped the closing brace of the test, which nested
the source name tests from main inside it so they no longer ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KzaQVQThQpmqhvLapk99Vs
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.

2 participants