From 2de3dcab94864a605aadf9acb0c8c405b203f283 Mon Sep 17 00:00:00 2001 From: Tyler Brock Date: Tue, 15 May 2012 13:54:44 -0400 Subject: [PATCH] RUBY-442 Using sysread so Ruby 1.8.x won't complain about nonblocking IO#read --- lib/mongo/util/tcp_socket.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/mongo/util/tcp_socket.rb b/lib/mongo/util/tcp_socket.rb index 2806ee8..3cb6faa 100644 --- a/lib/mongo/util/tcp_socket.rb +++ b/lib/mongo/util/tcp_socket.rb @@ -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