fix(daemon): actionable error when the WS port is in a Windows excluded range - #309
Open
captainhuke-dev wants to merge 1 commit into
Open
captainhuke-dev wants to merge 1 commit into
captainhuke-dev wants to merge 1 commit into
Conversation
…ed range On Windows, TcpListener::bind fails with WSAEACCES (os error 10013) when the port falls inside a dynamically-excluded range reserved by Hyper-V, WSL, or WinNAT. The default port 52800 can land in such a range, in which case 'bsk daemon start' failed with a bare 'access forbidden' and no hint. Detect the PermissionDenied bind failure and translate it into an actionable message: name the port, explain the excluded-range cause, and point to 'netsh interface ipv4 show excludedportrange protocol=tcp' plus '--port' and the extension popup (the extension connects to the port stored in the popup, not the one in daemon.json, so the two must match). Add a docs/architecture.md troubleshooting note and unit tests for the translation (Windows) and for leaving other bind errors untouched.
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.
Summary
On Windows,
TcpListener::bindfails withWSAEACCES(os error 10013) when the port falls inside a dynamically-excluded range reserved by Hyper-V, WSL, or WinNAT. The default port 52800 can land in such a range, in which casebsk daemon startfailed with a bare 'access forbidden' and no hint.This change detects the
PermissionDeniedbind failure and translates it into an actionable message: it names the port, explains the excluded-range cause, and points tonetsh interface ipv4 show excludedportrange protocol=tcp,bsk daemon start --port <port>, and the extension popup (the extension connects to the port stored in the popup, not the one indaemon.json, so the two must match).Why not auto-pick a port
The extension connects to a user-stored port (default 52800) and never reads
daemon.jsonor scans ports. A silent daemon-side port fallback would start the daemon on a port the extension does not dial, leaving 'daemon running but extension cannot connect'. Detection + an actionable error is the safe fix; auto-recovery is a larger protocol change (extension-side discovery) and is out of scope here.Verification
cargo test -p bsk --lib— alldaemon::wstests pass, including two new unit tests (Windows translation + leaving other bind errors untouched).cargo clippy -p bsk --lib— no new warnings (3 pre-existing in unrelated files).cargo +stable fmt -p bsk --check— clean.daemon readysuccess path unchangedFiles
crates/bsk-cli/src/daemon/ws.rs— bind-error translation + unit testsdocs/architecture.md— troubleshooting note