fix: incorrect Winsock error messages by using FormatMessage - #9337
Closed
claytonlin1110 wants to merge 1 commit into
Closed
fix: incorrect Winsock error messages by using FormatMessage#9337claytonlin1110 wants to merge 1 commit into
claytonlin1110 wants to merge 1 commit into
Conversation
Author
|
@sithlord48 Please review |
sithlord48
approved these changes
Jan 14, 2026
sithlord48
left a comment
Member
There was a problem hiding this comment.
Umm sure ...
@nbolton You can land after you review it
Member
I'll try to repro one of the messages to prove it works. |
Author
Member
Author
|
@nbolton Please review this |
Member
|
do not @ ppl for revew we are aware this needs review and it will get reviewed in time. If you have added changes and would like new review then up in the reviewer section hit the refresh button near the stale reviews name |
Member
|
This is actually quite badly done; it's low effort, probably untested and leaves redundant functions. Closing AI slop. |
Author
|
@nbolton Would you please re-review this? not an AI slop... |
Member
|
Something similar has been done by #9384 |
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.
Description
Fixes incorrect error messages for Winsock errors, particularly
WSAEACCES(10013), by replacing the hardcoded error message list withFormatMessage- the Microsoft-recommended approach.Problem
The
winsockErrorToQString()function used a hardcoded list of error messages that always returned the same message for each error code, regardless of the actual cause. For example,WSAEACCES(10013) always returned "The requested address is a broadcast address, but the appropriate flag was not set" even when the real issue was firewall blocking or other access-related problems.This led to confusing error messages that didn't reflect the actual error cause, making troubleshooting difficult for users.
Solution
Replaced the hardcoded implementation with a call to
windowsErrorToQString(), which uses Windows'FormatMessageAPI to retrieve accurate, localized error messages from the system.Testing
FormatMessagecorrectly handles Winsock error codesFixes #9067
Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=118192227