Socket.Windows: support ConnectAsync(SocketAsyncEventArgs) for UDP, and Unix sockets#33674
Socket.Windows: support ConnectAsync(SocketAsyncEventArgs) for UDP, and Unix sockets#33674scalablecory merged 5 commits intodotnet:masterfrom
Conversation
|
We'll want to run Outerloop tests before this can be merged. |
src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs
Outdated
Show resolved
Hide resolved
scalablecory
left a comment
There was a problem hiding this comment.
small question/nit, otherwise looks good.
|
Looks like there's no need to check @tmds with this change all tests are passing. It also includes an additional test for all connect variants to improve coverage. |
|
/azp run runtime-libraries outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
I'm guilty of not testing my proposal locally on Linux, and it looks like we have a bunch of related test failures, mostly specific to connect with IPv6 . I guess we are still missing something about that obscure |
| { | ||
| try | ||
| { | ||
| if (_currentSocket!.SocketType != SocketType.Stream) |
There was a problem hiding this comment.
@antonfirsov @scalablecory also give this condition some thought. Personally, I'm fine if CI passes. You may have a better understanding of what SO_UPDATE_CONNECT_CONTEXT does to decide if this is the most appropriate check.
There was a problem hiding this comment.
This should match the logic for CanUseConnectEx. We need to call SO_UPDATE_CONNECT_CONTEXT if ConnectEx is used.
There was a problem hiding this comment.
I was thinking the same thing, though it seems the stream unix socket, which doesn't support ConnectEx, doesn't give an error when we set this socket option.
We added the check because UDP socket gave an error.
|
@antonfirsov , you can push commits to this branch. |
|
@antonfirsov I noticed the failures are not Windows-only, I will investigate further. |
|
@tmds yes, they are mostly specific to Linux and IPv6 as far as I remember. |
|
@scalablecory @antonfirsov |
|
Thank you! Will take a look shortly. |
|
/azp run runtime-libraries outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
||
| return (_socketType == SocketType.Stream) && | ||
| (_rightEndPoint != null || remoteEP.GetType() == typeof(IPEndPoint)) && | ||
| (remoteEP.AddressFamily != AddressFamily.Unix); |
There was a problem hiding this comment.
I wonder if @stephentoub's #33674 (comment) also applies to AddressFamily ? Wouldn't it be more future proof to use the condition (remoteEP.AddressFamily == AddressFamily.InterNetwork || remoteEP.AddressFamily == AddressFamily.InterNetworkV6) instead?
There was a problem hiding this comment.
I have no preference for remoteEP.GetType() == typeof(IPEndPoint) vs (remoteEP.AddressFamily == AddressFamily.InterNetwork || remoteEP.AddressFamily == AddressFamily.InterNetworkV6), so I kept the check as it was.
antonfirsov
left a comment
There was a problem hiding this comment.
LGTM, and all test failures are unrelated. If someone else can confirm, I think we are safe to merge.
These are the changes from #787 that deal with making
ConnectAsync(SocketAsyncEventArgs)work for non-stream protocols (like UDP) on Windows.cc @stephentoub @antonfirsov @dotnet/ncl