Using sysread so Ruby 1.8.x won't complain about nonblocking IO#read
This commit is contained in:
Tyler Brock 2012-05-15 13:54:44 -04:00
parent d86c4d95f7
commit 2de3dcab94
1 changed files with 4 additions and 6 deletions

View File

@ -69,10 +69,8 @@ module Mongo
end end
if ready if ready
begin begin
@socket.read(maxlen, buffer) @socket.sysread(maxlen, buffer)
rescue EOFError, Errno::ETIMEDOUT rescue Errno::ENOTCONN, Errno::EBADF, Errno::ECONNRESET, Errno::EPIPE, Errno::ETIMEDOUT, EOFError
raise ConnectionError
rescue Errno::ENOTCONN, Errno::EBADF, Errno::ECONNRESET, Errno::EPIPE
raise ConnectionFailure raise ConnectionFailure
rescue Errno::EINTR, Errno::EIO, IOError rescue Errno::EINTR, Errno::EIO, IOError
raise OperationFailure raise OperationFailure