From 95f17aa2b9a8bf8d8b94b0c181892f4f955298dd Mon Sep 17 00:00:00 2001 From: Jonathan Hyman Date: Thu, 23 Apr 2015 22:50:24 -0400 Subject: [PATCH] Revert "Attempt to fix connection hanging issues. Retrofit of https://github.com/mongoid/moped/pull/331." This reverts commit fcf449fbf485031d6e198230c41c8b3d455fac58. --- lib/moped/sockets/connectable.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/moped/sockets/connectable.rb b/lib/moped/sockets/connectable.rb index 84e3043..625847d 100644 --- a/lib/moped/sockets/connectable.rb +++ b/lib/moped/sockets/connectable.rb @@ -3,7 +3,6 @@ module Sockets module Connectable attr_reader :host, :port - attr_accessor :timeout # Is the socket connection alive? # @@ -44,13 +43,7 @@ def self.included(klass) # @since 1.2.0 def read(length) check_if_alive! - handle_socket_errors { - if Kernel.select([self], nil, [self], @timeout) - super - else - raise Errors::ConnectionFailure, "timeout #{@timeout} exceeded on read from #{host}:#{port}" - end - } + handle_socket_errors { super } end # Write to the socket. @@ -159,7 +152,6 @@ def connect(host, port, timeout) sock = new(host, port) sock.set_encoding('binary') timeout_val = [ timeout, 0 ].pack("l_2") - sock.timeout = timeout sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, timeout_val) sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, timeout_val)