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

View File

@ -69,13 +69,11 @@ 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
end end
else else
raise OperationTimeout raise OperationTimeout