Skip to content

Commit

Permalink
Revert "Attempt to fix connection hanging issues. Retrofit of mongoid…
Browse files Browse the repository at this point in the history
…#331."

This reverts commit fcf449f.
  • Loading branch information
jonhyman committed Apr 24, 2015
1 parent fcf449f commit 95f17aa
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions lib/moped/sockets/connectable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Sockets
module Connectable

attr_reader :host, :port
attr_accessor :timeout

# Is the socket connection alive?
#
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 95f17aa

Please sign in to comment.