From 6663660d92d753a823b2238c25793ecdf23b0ae2 Mon Sep 17 00:00:00 2001 From: Tyler Brock Date: Mon, 14 May 2012 15:53:30 -0400 Subject: [PATCH] RUBY-442 Use read instead of readpartial. Rescue ETIMEDOUT and raise appropriate ConnectionError --- lib/mongo/util/tcp_socket.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mongo/util/tcp_socket.rb b/lib/mongo/util/tcp_socket.rb index 9c3e4d0..2806ee8 100644 --- a/lib/mongo/util/tcp_socket.rb +++ b/lib/mongo/util/tcp_socket.rb @@ -69,9 +69,9 @@ module Mongo end if ready begin - @socket.readpartial(maxlen, buffer) - rescue EOFError - return ConnectionError + @socket.read(maxlen, buffer) + rescue EOFError, Errno::ETIMEDOUT + raise ConnectionError rescue Errno::ENOTCONN, Errno::EBADF, Errno::ECONNRESET, Errno::EPIPE raise ConnectionFailure rescue Errno::EINTR, Errno::EIO, IOError