diff options
Diffstat (limited to 'lib/resolv.rb')
-rw-r--r-- | lib/resolv.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb index e67dff9704..9083bd0b53 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -1,6 +1,7 @@ require 'socket' require 'timeout' require 'thread' +require 'io/wait' begin require 'securerandom' @@ -680,7 +681,11 @@ class Resolv if timeout <= 0 raise ResolvTimeout end - select_result = IO.select(@socks, nil, nil, timeout) + if @socks.size == 1 + select_result = @socks[0].wait_readable(timeout) ? [ @socks ] : nil + else + select_result = IO.select(@socks, nil, nil, timeout) + end if !select_result after_select = Time.now next if after_select < timelimit |