diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-11-10 01:24:10 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-11-10 01:25:09 +0000 |
commit | 9c0a7c670494fb55fb8ef98838fa0f53aab38d0d (patch) | |
tree | 4812ef4168e26c701c0011730c0bfd011bc1e7c8 | |
parent | 38a38766deef994577cfb89e7a1b5a30e8bcd7eb (diff) | |
download | mogilefs-client-9c0a7c670494fb55fb8ef98838fa0f53aab38d0d.tar.gz |
The return value of IO#wait is strange and confusing, relying on FIONREAD is a waste of time anyways.
-rw-r--r-- | lib/mogilefs/socket/pure_ruby.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/mogilefs/socket/pure_ruby.rb b/lib/mogilefs/socket/pure_ruby.rb index 24cd5ca..df8dfb9 100644 --- a/lib/mogilefs/socket/pure_ruby.rb +++ b/lib/mogilefs/socket/pure_ruby.rb @@ -1,6 +1,5 @@ # -*- encoding: binary -*- # internal implementation details here, do not rely on them in your code -require "io/wait" class MogileFS::Socket < Socket include MogileFS::SocketCommon @@ -27,7 +26,7 @@ class MogileFS::Socket < Socket begin return read_nonblock(len, dst) rescue Errno::EAGAIN - wait(timeout) or unreadable_socket! + IO.select([self], nil, nil, timeout) or unreadable_socket! rescue EOFError return end while true @@ -38,7 +37,7 @@ class MogileFS::Socket < Socket rc = recv_nonblock(len, Socket::MSG_PEEK) return rc.empty? ? nil : dst.replace(rc) rescue Errno::EAGAIN - wait(timeout) or unreadable_socket! + IO.select([self], nil, nil, timeout) or unreadable_socket! rescue EOFError dst.replace("") return |