1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

care EWOULDBLOCK of accept_nonblock.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-02-17 11:05:35 +00:00
parent 2f8b471b89
commit 536adb5d7c

View file

@ -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