[前][次][番号順一覧][スレッド一覧]

ruby-changes:10807

From: akr <ko1@a...>
Date: Tue, 17 Feb 2009 20:09:39 +0900 (JST)
Subject: [ruby-changes:10807] Ruby:r22375 (trunk): care EWOULDBLOCK of accept_nonblock.

akr	2009-02-17 20:05:35 +0900 (Tue, 17 Feb 2009)

  New Revision: 22375

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22375

  Log:
    care EWOULDBLOCK of accept_nonblock.

  Modified files:
    trunk/test/socket/test_nonblock.rb

Index: test/socket/test_nonblock.rb
===================================================================
--- test/socket/test_nonblock.rb	(revision 22374)
+++ test/socket/test_nonblock.rb	(revision 22375)
@@ -15,7 +15,12 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]