summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-06 20:30:43 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-06 20:30:43 +0000
commit84b012e02a567f79dc3061cd860be982f95be048 (patch)
tree78dc35d87193481c49ff2c0ec1c2dd30639867be /ext/socket
parent8e08552ed01e827b4e3ca3e0d57695a8737cb394 (diff)
stdlib: use IO#wait_*able instead of IO.select when possible
In case a process encounters high-numbered FDs, this allows consistent performance on systems with ppoll support. [ruby-core:35572] * ext/socket/lib/socket.rb (connect_nonblock): use IO#wait_writable * lib/drb/drb.rb (DRB::DRbTCPSocket#alive?): use IO#wait_readable * lib/webrick/httpserver.rb (run): ditto * lib/resolv.rb (request): ditto for single socket case [ruby-core:68943] [Feature #11081] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/lib/socket.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index 2723f7b..7c66e8f 100644
--- a/ext/socket/lib/socket.rb
+++ b/ext/socket/lib/socket.rb
@@ -1,4 +1,5 @@
require 'socket.so'
+require 'io/wait'
class Addrinfo
# creates an Addrinfo object from the arguments.
@@ -54,9 +55,8 @@ class Addrinfo
when 0 # success or EISCONN, other errors raise
break
when :wait_writable
- if !IO.select(nil, [sock], nil, timeout)
+ sock.wait_writable(timeout) or
raise Errno::ETIMEDOUT, 'user specified timeout'
- end
end while true
else
sock.connect(self)