Skip to content

Commit

Permalink
Enable BeginAcceptV4BoundToAnyV4_Success with better timeout handling (
Browse files Browse the repository at this point in the history
  • Loading branch information
antonfirsov authored Jul 30, 2021
1 parent 6d79c7e commit c118572
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,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 @@ -844,6 +843,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 @@ -866,10 +872,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

0 comments on commit c118572

Please sign in to comment.