diff options
author | Katelyn Gadd <kg@luminance.org> | 2018-01-05 07:31:14 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2018-01-05 12:27:26 +0300 |
commit | 1f174145d1e6efa7008e353083f4d1ed0c8b0e69 (patch) | |
tree | e5481d9c9100bc559ffebcd4d49382f19868318f /mcs/class/System | |
parent | 861e52e25c5ab6d6a670b42dd330276e1776b11f (diff) |
Fix a race condition in TcpListenerTest caused by sockets' accept queue not filling instantly when machine is under load
Diffstat (limited to 'mcs/class/System')
-rw-r--r-- | mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs index 15b48e5fe2b..c3bf7e2ac19 100644 --- a/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs @@ -49,7 +49,10 @@ namespace MonoTests.System.Net.Sockets } } - // make sure the connection arrives + // There is no guarantee that the connecting socket will be in the listener's + // accept queue yet (though it is highly likely on Linux). We wait up to one + // second for the connecting socket to enter the listener's accept queue. + Assert.IsTrue (inListener.Server.Poll (1000, SelectMode.SelectRead)); Assert.IsTrue (inListener.Pending ()); Socket inSock = inListener.AcceptSocket (); |