Skip to content

feat(server): add opt-in latest-state scheduling and stop barriers - #955

Open
xmsama wants to merge 1 commit into
buttplugio:masterfrom
xmsama:pr/latest-state-output
Open

xmsama wants to merge 1 commit into
buttplugio:masterfrom
xmsama:pr/latest-state-output

Conversation

@xmsama

@xmsama xmsama commented Sep 24, 2026

Copy link
Copy Markdown

Summary

Implements the output-scheduling scope approved in #954.

  • Add an opt-in latest-state scheduler with one hardware-write batch in flight and coalescing of superseded pending commands.
  • Preserve explicit stops and zero-valued intensity commands as urgent barriers; subsequent motion cannot overwrite an unsent stop. Position zero remains a valid endpoint.
  • Bound individual writes to two seconds. On write failure, timeout, or hardware disconnect, discard pending motion rather than retrying it on the same connection.
  • Force explicit stop generation only for opted-in protocols. Preserve the existing scheduler, keepalive behavior, and stop deduplication for other protocols.

This PR adds the infrastructure only. The companion Yiciyuan PR enables it for FJB-02/FJB-03. It introduces no zero-value hold, Bluetooth connection retries, or client/UI changes.

Validation

Windows, Rust 1.96.0:

  • cargo test -p buttplug_server --lib: 42 passed.
  • cargo test -p buttplug_tests --test test_device_protocols: 861 passed.
  • Scheduler tests cover slow-write coalescing, single-flight ordering, stop barriers, pacing bypass, write failure, write timeout, and disconnect during a blocked write.

These counts are suite totals. Tests use simulated hardware. A completed OS write is not a device execution acknowledgement; a failed or disconnected BLE link cannot guarantee physical motor stop.

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.

1 participant