Repository navigation
Gamepads: keep Moonlight controllers hidden from the host after the first reconnection - #95
Merged
Merged
Conversation
…oller leaves The reservation of the next ViGEmBus controllers only protected the first connection after the service started. When a Moonlight client disconnected, the periodic scan tried to reserve the freed number before removing the old controller's jail entry, skipped it because that entry still existed, but recorded it as reserved anyway. Once the old entry was removed, that number had no reservation and the next controller appeared visible to the host again (seen in the log as a 5 s wait while Windows refused to restart it). Only reservations that were actually added are recorded now, and reservations are synced after removing the controllers that left. A log line says when reservations become active or are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
#94 hides the next ViGEmBus controllers from every session before they appear. On a test PC it worked for the first connection after the service started, but not after a client reconnected: the log showed the old path again, with a 5 s wait between the assignment and "visible only in…", which is Windows refusing to restart a controller that another process already has open.
Cause: when a client disconnected, the periodic scan tried to reserve the freed number before removing the old controller's jail entry.
ReserveJailsskipped it because the entry still existed, butSyncReservationsrecorded it as reserved anyway. After the old entry was removed, that number had no reservation, and nothing re-added it.What changes
ReserveJailsreturns the ids it actually reserved, and only those are recorded. A skipped id is retried on the next scan.Testing
dotnet test: 171/171.🤖 Generated with Claude Code