Repository navigation
Re-pin sendspin-cpp to 78b13d5e, move off its deprecated APIs and read pairing from is_paired() - #115
Merged
Merged
Conversation
3a3722a8 is sendspin-cpp#218 as merged, which adds application-specific roles. It brings #234, which removes ConnectionTrust and on_trust_changed() for SendspinClient::is_paired(). The main loop now polls it and logs "Connected server is paired/not paired" when a session is new or re-keyed, as the callback did. status reads it before is_connected(), as the library asks. Its trust line loses "unknown": a connected session is always paired or not.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Clearing server_id_ on the first connected tick can discard a newly started pairing attempt and incorrectly report pairing: none; the callback ordering needs a fix and regression test.
1 open issue
What changed in this PR
Updates sendspin-cpp to 3a3722a8, enabling the application-role support needed for local pairing in #110, and migrates pairing state to the new is_paired() API.
Changes:
- Re-pins the dependency and updates the roadmap reference.
- Replaces trust callbacks with main-loop polling and direct pairing-state reads for status.
- Updates status formatting and tests to remove the
unknowntrust state.
| File | Description |
|---|---|
tests/control_test.cpp |
Tests paired, unpaired, and disconnected status values. |
src/main.cpp |
Polls pairing state and migrates status snapshots to is_paired(). |
src/control.h |
Replaces optional trust with a pairing boolean. |
src/control_common.cpp |
Formats trust using connection and pairing state. |
docs/ROADMAP.md |
Updates the documented dependency pin. |
CMakeLists.txt |
Pins sendspin-cpp to 3a3722a8. |
Review effort: Balanced
…s up A new session's first server/activate can start pairing, and loop() delivers that start before is_connected() first reads true. Clearing the attempt on the session's rising edge then wiped the live attempt, and status reported no pairing while one was in progress. Clear it on the falling edge instead: an attempt on a dropped connection is the only one that never reports its end. PairingListener moves to its own file so its tick and callback ordering can be tested.
Moves the pin to the head of sendspin-cpp main, seven commits past 3a3722a8. None of them touches is_paired(), is_connected() or the pairing callbacks this PR relies on. connect_to() now takes its URL by value, which the existing call site compiles against unchanged. None of the library gaps listed in the roadmap is closed by these commits.
3c28f669 broke the linux-armv6 build: CONNECTION_BLOCK_BYTES left 32 bytes for the shared_ptr control block, and Raspbian's libstdc++ uses the mutex lock policy, which needs 48. sendspin-cpp#263 fixes that and merged as 78b13d5e. The commits between them deprecate the callbacks and accessors this CLI used, and -Werror turns each use into an error. The CLI now overrides on_pairing_attempt, on_paired, on_pairing_aborted, on_pairing_code and on_track_metadata, and reads server_information() and client_pairing_token(). Their text arrives as string_view, valid only for the callback or until the next loop(), so whatever status, the hooks or the state store keep is copied first.
At this pin a server that cancels pairing with a server/activate ends the attempt with no callback at all: on_trust_changed, which used to clear it, is gone, and the prompt dismissals fire only for an attempt that showed a code or a window. A token attempt cancelled that way stayed in status as in progress until the connection dropped. The library arms a 120 s deadline when an attempt starts, so an attempt that shows no prompt has an outcome, a timeout or a dropped connection by then unless the server cancelled it. The listener now forgets such an attempt 150 s after a tick first saw it. A dropped connection now forgets only an attempt an earlier tick saw. One that loop() delivered in the same pass may be the next session's first attempt.
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.

Why
sendspin-cpp#218 adds
SendspinClientConfig::application_roles, which #110 needs for local pairing. Moving the pin past it also brings sendspin-cpp#234, which removesConnectionTrustandon_trust_changed()in favour ofSendspinClient::is_paired(), so the pin cannot move without this migration.What
78b13d5e, sendspin-cppmainwith #263 merged, 45 commits pastb0fcf5bb. An intermediate pin,3c28f669, broke the linux-armv6 build:CONNECTION_BLOCK_BYTESleft 32 bytes for theshared_ptrcontrol block, and Raspbian's libstdc++ uses the mutex lock policy, which needs 48. #263 fixes that.-Werrorturns each use into an error. The CLI now overrideson_pairing_attempt,on_paired,on_pairing_aborted,on_pairing_codeandon_track_metadata, and readsserver_information()andclient_pairing_token(). Their text arrives asstd::string_view, valid only for the callback or until the nextloop(), so whateverstatus, the hooks or the state store keep is copied first.statuskeeps only the artist, title and progress it reports.PairingListenerpollsis_paired()once per main-loop tick instead of the removed callback, reading it beforeis_connected()as the library asks. It still logsConnected server is paired/not pairedwhen a session is new or has been re-keyed.server/activatecan start pairing, andclient.loop()delivers its start beforeis_connected()first reads true, so clearing on the rising edge wiped the live attempt andstatusreportedpairing: noneduring the exchange.PairingListenermoves to its own file so that ordering can be tested.server/activateis forgotten. At this pin that ends the attempt with no callback:on_trust_changed, which used to clear it, is gone, and the prompt dismissals fire only for an attempt that showed a code or a window. The library arms a 120 s deadline when an attempt starts, so an attempt that shows no prompt has an outcome, a timeout or a dropped connection by then unless the server cancelled it; the listener forgets such an attempt 150 s after it first saw it. A dropped connection forgets only an attempt an earlier tick saw, since oneloop()delivered in the same pass may be the next session's. Known limit: a cancelled token attempt still shows instatusfor up to 150 s; reporting the cancel needs a library callback.statusreadsis_paired()beforeis_connected()too. Thetrustline ispaired,unpairedornot connectedas before.unknownis gone: a connected session is always one or the other.docs/ROADMAP.mditem 3 names the new pin. None of the library gaps it lists is closed by these commits.Compatibility
No flag, config key, control-socket message, state format or exit code changes. The only visible difference is that
statusno longer printstrust: unknown.Testing
At
78b13d5ewithmainmerged in (90bfa89),-DSENDSPIN_CLI_WERROR=ON, no warnings:ctest558/558 passed;scripts/smoke_test.sh: every check passed.--versionreportssendspin-cpp 78b13d5e….ctest550/550 passed (the existing symlink test is skipped, as onmain).main, in the same Raspbian image and with the same options asbuild-armv6.yml, under qemu: builds, with all six audio backends anddns_sdfound;readelfreportsTag_CPU_arch: v6with hard-float.ctest558 of 561 passed. The three failures areStateStoretests that make a directory read-only and expect a write to fail, and the container ran as root, which writes regardless; CI runs them unprivileged.tests/pairing_listener_test.cpp, 9 cases: an attempt started before the session reads connected is kept; one on a connection that stays is kept; one an earlier tick saw is forgotten when its connection drops, but one delivered in the loop that sees the drop is kept; an outcome or a withdrawn code or window ends it; an unprompted attempt is forgotten at the 150 s limit and not a millisecond before, a prompted one is not, and a new attempt restarts the clock. Disabling the fallback, or the same-loop rule, each fails exactly its test.