You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a Windows host running the current release and prerelease without the Virtual HID Driver installed, every broker request blocks for the 5 s retry deadline. connect_to_broker_pipe treats ERROR_FILE_NOT_FOUND from CreateFileA as "the broker is still starting" and retries every 10 ms for 5000 ms, but when the libvirtualhid_broker service was never installed the pipe can never appear.
Sunshine calls lvh::get_license_status() on its input thread at every controller arrival, which is the 5 s input hold in LizardByte/Sunshine#5759.
This change asks the Service Control Manager once, on the first ERROR_FILE_NOT_FOUND, whether the broker service exists.
If OpenServiceW fails with ERROR_SERVICE_DOES_NOT_EXIST, the connect fails immediately with that error instead of spending the deadline. Any other answer (service manager can't be opened, access denied, service present) keeps the existing retry behaviour, so a broker that is genuinely starting is still waited for.
The check runs on the first attempt only so a starting broker isn't hit with an SCM lookup every 10 ms, and the path that works is unchanged.
An installed-but-stopped service still waits as before; a restart passes through STOPPED and the wait is what makes that case succeed. make_unique_service_handle moved up a few lines so the new helper can use it.
Measured on a Windows 11 host with the driver package uninstalled, timing get_license_status() from a small test program: 7998 / 8015 / 8048 ms before, 0 / 0 / 0 ms after, and the error text goes from "The system cannot find the file specified" to "The specified service does not exist as an installed service".
With the service present the call takes 0–21 ms before and after.
Tests: two new fixture scenarios, pipe_service_missing (service absent: 1 create attempt, 0 sleeps) and pipe_service_manager_unavailable (SCM can't be opened: the deadline is still honoured), and the existing pipe retry rows now account for the extra service-manager and service handles the check opens and closes.
WindowsBrokerClientTest passes 7/7 with and without the change; the rest of the suite shows the same pre-existing device-creation failures on this machine either way.
If you're not starting the broker service manually or via trigger start, you should probably check to see if the service is running too, otherwise you'll have this same issue if the service is stopped/disabled for some reason.
❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 73.99%. Comparing base (02fe328) to head (95522e5).
✅ All tests successful. No failed tests found.
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
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.
Description
On a Windows host running the current release and prerelease without the Virtual HID Driver installed, every broker request blocks for the 5 s retry deadline.
connect_to_broker_pipetreatsERROR_FILE_NOT_FOUNDfromCreateFileAas "the broker is still starting" and retries every 10 ms for 5000 ms, but when thelibvirtualhid_brokerservice was never installed the pipe can never appear.Sunshine calls
lvh::get_license_status()on its input thread at every controller arrival, which is the 5 s input hold in LizardByte/Sunshine#5759.This change asks the Service Control Manager once, on the first
ERROR_FILE_NOT_FOUND, whether the broker service exists.If
OpenServiceWfails withERROR_SERVICE_DOES_NOT_EXIST, the connect fails immediately with that error instead of spending the deadline. Any other answer (service manager can't be opened, access denied, service present) keeps the existing retry behaviour, so a broker that is genuinely starting is still waited for.The check runs on the first attempt only so a starting broker isn't hit with an SCM lookup every 10 ms, and the path that works is unchanged.
An installed-but-stopped service still waits as before; a restart passes through
STOPPEDand the wait is what makes that case succeed.make_unique_service_handlemoved up a few lines so the new helper can use it.Measured on a Windows 11 host with the driver package uninstalled, timing
get_license_status()from a small test program: 7998 / 8015 / 8048 ms before, 0 / 0 / 0 ms after, and the error text goes from "The system cannot find the file specified" to "The specified service does not exist as an installed service".With the service present the call takes 0–21 ms before and after.
Tests: two new fixture scenarios,
pipe_service_missing(service absent: 1 create attempt, 0 sleeps) andpipe_service_manager_unavailable(SCM can't be opened: the deadline is still honoured), and the existing pipe retry rows now account for the extra service-manager and service handles the check opens and closes.WindowsBrokerClientTestpasses 7/7 with and without the change; the rest of the suite shows the same pre-existing device-creation failures on this machine either way.Screenshot
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage
See our AI usage policy.