Skip to content
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

Enable BeginAcceptV4BoundToAnyV4_Success with better timeout handling #56406

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ public void BeginAcceptV4BoundToSpecificV4_Success()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/45810", TestRuntimes.Mono)]
public void BeginAcceptV4BoundToAnyV4_Success()
{
DualModeConnect_BeginAccept_Helper(IPAddress.Any, IPAddress.Loopback);
Expand Down Expand Up @@ -850,6 +849,13 @@ private void DualModeConnect_BeginAccept_Helper(IPAddress listenOn, IPAddress co
serverSocket.Listen(1);
IAsyncResult async = serverSocket.BeginAccept(null, null);
SocketClient client = new SocketClient(_log, serverSocket, connectTo, port);

Assert.True(
client.WaitHandle.WaitOne(TestSettings.PassingTestTimeout),
"Timed out while waiting for connection");
Assert.True(
async.AsyncWaitHandle.WaitOne(TestSettings.PassingTestTimeout),
"Timed out while waiting to accept the client");

// Due to the nondeterministic nature of calling dispose on a Socket that is doing
// an EndAccept operation, we expect two types of exceptions to happen.
Expand All @@ -872,10 +878,6 @@ private void DualModeConnect_BeginAccept_Helper(IPAddress listenOn, IPAddress co
catch (ObjectDisposedException) { }
catch (SocketException) { }

Assert.True(
client.WaitHandle.WaitOne(TestSettings.PassingTestTimeout),
"Timed out while waiting for connection");

if (client.Error != SocketError.Success)
{
throw new SocketException((int)client.Error);
Expand Down