Repository navigation
fix(devices): set up StateMap for devices that connect after ready - #14
Draft
joethesaint wants to merge 1 commit into
Draft
joethesaint wants to merge 1 commit into
joethesaint wants to merge 1 commit into
Conversation
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.
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.
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 tostateMapCallback, which nothing reads any more: it shows as connected but never reports a track.Once
'ready'has fired,connectToDevicenow sets up StateMap straight away, with the same logged catch as the callback.Test: a device that connects after ready gets
setupStateMapcalled. It fails on the old source and passes with the change;tsc --noEmitis clean. The full suite has three failures that are also on a cleanmainhere (getTempFilePathcompares 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
mainindependently; both append a test block at the end oftest/network/StageLinqDevices.test.ts, so whichever merges second has a trivial conflict there: keep both blocks.)