class Redis::Connection::UNIXSocket
def self.connect(path, timeout)
def self.connect(path, timeout) Timeout.timeout(timeout) do sock = new(path) sock end rescue Timeout::Error raise TimeoutError end
def self.connect(path, timeout)
def self.connect(path, timeout) sock = new(::Socket::AF_UNIX, Socket::SOCK_STREAM, 0) sockaddr = ::Socket.pack_sockaddr_un(path) begin sock.connect_nonblock(sockaddr) rescue Errno::EINPROGRESS raise TimeoutError unless sock.wait_writable(timeout) begin sock.connect_nonblock(sockaddr) rescue Errno::EISCONN end end sock end
def _read_from_socket(nbytes, _buffer = nil)
def _read_from_socket(nbytes, _buffer = nil) # JRuby: Throw away the buffer as we won't need it # but still need to support the max arity of 2 readpartial(nbytes) rescue EOFError raise Errno::ECONNRESET end