Skip to content

Conversation

@graebm
Copy link
Contributor

@graebm graebm commented May 24, 2022

Issue: Discovered when running tests in Debug on Windows. The error codes reported from socket functions were NOT what was expected. Investigation revealed that the value from WSAGetLastError() would get reset to 0 as a side-effect of logging. This was only happening in Debug, which is why we weren't catching it in CI.

Therefore: Always call WSAGetLastError() immediately after a socket function fails, and store the value for use later.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Issue: Discovered when running tests in Debug on Windows. The error codes reported from socket functions were NOT what was expected. Investigation revealed that the value from `WSAGetLastError()` would get reset to 0 as a side-effect of logging.

Therefore: Always call  `WSAGetLastError()` **immediately** after a socket function fails, and store the value for use later.
@graebm graebm merged commit 66a38bc into main May 24, 2022
@graebm graebm deleted the WSAGetLastError branch May 24, 2022 23:41
graebm added a commit that referenced this pull request May 25, 2022
Issue: Discovered when running tests in Debug on Windows. The error codes reported from socket functions were NOT what was expected. Investigation revealed that the value from `WSAGetLastError()` would get reset to 0 as a side-effect of logging. This was only happening in Debug, which is why we weren't catching it in CI.

Therefore: Always call  `WSAGetLastError()` **immediately** after a socket function fails, and store the value for use later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants