summaryrefslogtreecommitdiff
path: root/test/socket
diff options
context:
space:
mode:
Diffstat (limited to 'test/socket')
-rw-r--r--test/socket/test_nonblock.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/socket/test_nonblock.rb b/test/socket/test_nonblock.rb
index ea6a903e72..abc844ceb8 100644
--- a/test/socket/test_nonblock.rb
+++ b/test/socket/test_nonblock.rb
@@ -15,7 +15,12 @@ class TestSocketNonblock < Test::Unit::TestCase
assert_raise(Errno::EAGAIN, Errno::EWOULDBLOCK) { serv.accept_nonblock }
c = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
c.connect(serv.getsockname)
- s, sockaddr = serv.accept_nonblock
+ begin
+ s, sockaddr = serv.accept_nonblock
+ rescue Errno::EWOULDBLOCK
+ IO.select nil, [serv]
+ s, sockaddr = serv.accept_nonblock
+ end
assert_equal(Socket.unpack_sockaddr_in(c.getsockname), Socket.unpack_sockaddr_in(sockaddr))
ensure
serv.close if serv