Skip to content

Commit

Permalink
Fix Windows ConnectAsync(saea) for non-stream protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
tmds committed Mar 2, 2020
1 parent d0cdc06 commit be45f45
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3752,6 +3752,7 @@ private bool ConnectAsync(SocketAsyncEventArgs e, bool userSocket)

WildcardBindForConnectIfNecessary(endPointSnapshot.AddressFamily);

bool canUseConnectEx = CanUseConnectEx(endPointSnapshot);
// Save the old RightEndPoint and prep new RightEndPoint.
EndPoint? oldEndPoint = _rightEndPoint;
if (_rightEndPoint == null)
Expand All @@ -3767,7 +3768,7 @@ private bool ConnectAsync(SocketAsyncEventArgs e, bool userSocket)
SocketError socketError = SocketError.Success;
try
{
if (CanUseConnectEx(endPointSnapshot))
if (canUseConnectEx)
{
socketError = e.DoOperationConnectEx(this, _handle);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public async Task Socket_ConnectAsyncUnixDomainSocketEndPoint_NotServer()
}

Assert.Equal(
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? SocketError.InvalidArgument : SocketError.AddressNotAvailable,
RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? SocketError.ConnectionRefused : SocketError.AddressNotAvailable,
args.SocketError);
}
}
Expand Down

0 comments on commit be45f45

Please sign in to comment.