Simplify winsock initialization#43284
Merged
jkotas merged 7 commits intodotnet:masterfrom Oct 13, 2020
Merged
Conversation
jkotas
commented
Oct 11, 2020
src/libraries/Common/src/System/Net/SocketProtocolSupportPal.Windows.cs
Outdated
Show resolved
Hide resolved
|
Tagging subscribers to this area: @dotnet/ncl |
stephentoub
reviewed
Oct 12, 2020
src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.Windows.cs
Outdated
Show resolved
Hide resolved
….Windows.cs Co-authored-by: Stephen Toub <stoub@microsoft.com>
stephentoub
reviewed
Oct 12, 2020
src/libraries/Common/src/Interop/Windows/WinSock/Interop.WSAStartup.cs
Outdated
Show resolved
Hide resolved
stephentoub
reviewed
Oct 12, 2020
| if (Interlocked.CompareExchange(ref s_initialized, 1, 0) != 0) | ||
| { | ||
| // Keep the winsock initialization count ballanced if other thread beats us to finish the initialization. | ||
| WSACleanup(); |
Member
There was a problem hiding this comment.
I assume this is just for good hygiene? Since we're not cleaning up after these in general, presumably it wouldn't matter technically right now if there were a few extra startups in there.
Member
Author
There was a problem hiding this comment.
Yes, this is just for good hygiene. I will add comment about it.
stephentoub
reviewed
Oct 12, 2020
| { | ||
| WSAData d; | ||
| return WSAStartup(0x0202 /* 2.2 */, &d); | ||
| if (s_initialized == 0) |
Member
There was a problem hiding this comment.
Might be worth a brief comment about why volatile isn't necessary here.
…artup.cs Co-authored-by: Stephen Toub <stoub@microsoft.com>
stephentoub
reviewed
Oct 12, 2020
src/libraries/System.Net.NameResolution/src/System/Net/NameResolutionPal.Windows.cs
Outdated
Show resolved
Hide resolved
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Change winsock initialization to be internal detail of Windows PAL. It is unnecessary on non-Windows platforms.