Skip to content

Commit c118572

Browse files
authored
Enable BeginAcceptV4BoundToAnyV4_Success with better timeout handling (#56406)
1 parent 6d79c7e commit c118572

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/libraries/System.Net.Sockets/tests/FunctionalTests/DualModeSocketTest.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,6 @@ public void BeginAcceptV4BoundToSpecificV4_Success()
782782
}
783783

784784
[Fact]
785-
[ActiveIssue("https://github.com/dotnet/runtime/issues/45810", TestRuntimes.Mono)]
786785
public void BeginAcceptV4BoundToAnyV4_Success()
787786
{
788787
DualModeConnect_BeginAccept_Helper(IPAddress.Any, IPAddress.Loopback);
@@ -844,6 +843,13 @@ private void DualModeConnect_BeginAccept_Helper(IPAddress listenOn, IPAddress co
844843
serverSocket.Listen(1);
845844
IAsyncResult async = serverSocket.BeginAccept(null, null);
846845
SocketClient client = new SocketClient(_log, serverSocket, connectTo, port);
846+
847+
Assert.True(
848+
client.WaitHandle.WaitOne(TestSettings.PassingTestTimeout),
849+
"Timed out while waiting for connection");
850+
Assert.True(
851+
async.AsyncWaitHandle.WaitOne(TestSettings.PassingTestTimeout),
852+
"Timed out while waiting to accept the client");
847853

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

869-
Assert.True(
870-
client.WaitHandle.WaitOne(TestSettings.PassingTestTimeout),
871-
"Timed out while waiting for connection");
872-
873875
if (client.Error != SocketError.Success)
874876
{
875877
throw new SocketException((int)client.Error);

0 commit comments

Comments
 (0)