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,13 +69,11 @@ module Mongo
end
if ready
begin
@socket.read(maxlen, buffer)
rescue EOFError, Errno::ETIMEDOUT
raise ConnectionError
rescue Errno::ENOTCONN, Errno::EBADF, Errno::ECONNRESET, Errno::EPIPE
@socket.sysread(maxlen, buffer)
rescue Errno::ENOTCONN, Errno::EBADF, Errno::ECONNRESET, Errno::EPIPE, Errno::ETIMEDOUT, EOFError
raise ConnectionFailure
rescue Errno::EINTR, Errno::EIO, IOError
raise OperationFailure
rescue Errno::EINTR, Errno::EIO, IOError
raise OperationFailure
end
else
raise OperationTimeout