Skip to content

fix(devices): set up StateMap for devices that connect after ready - #14

Draft
joethesaint wants to merge 1 commit into
chrisle:mainfrom
joethesaint:fix/statemap-for-late-devices
Draft

joethesaint wants to merge 1 commit into
chrisle:mainfrom
joethesaint:fix/statemap-for-late-devices

Conversation

@joethesaint

Copy link
Copy Markdown

StateMap is set up from the device-watch callback, which emits 'ready' once and isn't scheduled again. A device that connects after that (a second player joining, or the same player back after a reboot on a new port) is added to stateMapCallback, which nothing reads any more: it shows as connected but never reports a track.

Once 'ready' has fired, connectToDevice now sets up StateMap straight away, with the same logged catch as the callback.

Test: a device that connects after ready gets setupStateMap called. It fails on the old source and passes with the change; tsc --noEmit is clean. The full suite has three failures that are also on a clean main here (getTempFilePath compares Windows paths with /tmp/localdb), so they are not from this change.

(With #13, a player back after a reboot is forgotten when it goes, reconnects on its next announcement, and with this PR gets its StateMap again. The two apply to main independently; both append a test block at the end of test/network/StageLinqDevices.test.ts, so whichever merges second has a trivial conflict there: keep both blocks.)

StateMap is set up from the device-watch callback, which emits 'ready' once
and is not scheduled again. A device that connected after that (a second
player joining, or the same player back after a reboot with a new port) was
added to stateMapCallback, which nothing reads any more: it showed as
connected but never reported a track.

Once 'ready' has fired, connectToDevice now sets up StateMap straight away
(with the same logged catch as the callback).

Test: a device connecting after ready gets setupStateMap called.
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