Skip to content

Mesh: keep pair.sync per-peer when another device is selected - #195

Open
hughesyadaddy wants to merge 2 commits into
InukaAsith:mainfrom
hughesyadaddy:fix/mesh-pairsync-non-selected
Open

hughesyadaddy wants to merge 2 commits into
InukaAsith:mainfrom
hughesyadaddy:fix/mesh-pairsync-non-selected

Conversation

@hughesyadaddy

Copy link
Copy Markdown
Contributor

Fixes #193

In Multi-device (mesh) mode, PairSync uses the hub facade, which only delivers messages from the currently selected peer (hub._fromDevice routes to selectedId only). Switch changes and the host's pair.sync {all} on connect were dropped for other connected peers, so settings.pairSync[peerId] drifted apart.

Change: In mesh main.js on Mac, Windows, and Linux, pass hub.bus into PairSync. Listen for pair.sync on the bus from non-selected peers and merge into that peer's saved entry only (live global switches untouched). When hosting a guest that is not selected, send that peer's saved all on bus welcome. The selected peer still uses the facade, so nothing is handled twice.

Tests: shared/test/pairsync.js: stash while another device is selected, bus welcome all to a non-selected guest, facade vs bus for the selected peer. Existing two-device tests unchanged (node shared/test/pairsync.js passes).

In multi-device mode the hub facade only delivers messages from the
selected peer, so pair.sync updates were dropped and pairSync entries
drifted. Listen on hub.bus for pair.sync from other peers, merge into
settings.pairSync only, and send saved values on bus welcome when hosting
a guest that is not selected.
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.

Multi-device: per-pair switches drift apart because pair.sync from a non-selected device is dropped

1 participant