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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NameResolutionPal.Unix enabled async name resolution #34633
NameResolutionPal.Unix enabled async name resolution #34633
Changes from 12 commits
fc09ca1
8c955bc
cf13c70
4614267
1b2daab
b9629e9
6f64c86
e7df0cc
d7cb2be
74b3031
775ff72
ec8522f
298cf03
458579b
8f69164
8cec5fb
f3ebd6a
cf45cc9
43f889f
bd16c74
ed5c39f
b8efde5
04dbd8e
37e4dd3
7176378
b64867b
900834e
198717e
f85c316
438c75a
89c266f
33da8da
fa9c6f9
8266dd3
75e52c7
89a7c5a
dd1e245
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the fence necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This callback comes in on another thread. It ensures visibility to this thread of everything in
state
.getaddrinfo_a
probably does something like this already, so it might be safe to remove, but it isn't documented.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
malloc() result is NULL-checked but strdup() isn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do both allocations here in a single one by using a flexible member in struct GetAddrInfoAsyncState:
Also, I'd bail out if addrlen > 253 (hostnames can't be larger than that per the RFC; otherwise, you'd have to check for overflow before passing the len to malloc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: You don't need to null-check before calling free(). free() can take any value returned by malloc(), including NULL. (Change is harmless, but something to keep in mind.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the valuable input!
Maybe it was an artefact of the bug hunt, but Valgrind complained this. That's why I changed this. Will revert to the cleaner version.