class Redis::Connection::TCPSocket
Public Class Methods
connect(host, port, timeout)
click to toggle source
# File lib/redis/connection/ruby.rb, line 114 def self.connect(host, port, timeout) Timeout.timeout(timeout) do sock = new(host, port) sock end rescue Timeout::Error raise TimeoutError end
connect_addrinfo(addrinfo, port, timeout)
click to toggle source
# File lib/redis/connection/ruby.rb, line 156 def self.connect_addrinfo(addrinfo, port, timeout) sock = new(::Socket.const_get(addrinfo[0]), Socket::SOCK_STREAM, 0) sockaddr = ::Socket.pack_sockaddr_in(port, addrinfo[3]) begin sock.connect_nonblock(sockaddr) rescue Errno::EINPROGRESS raise TimeoutError if IO.select(nil, [sock], nil, timeout).nil? begin sock.connect_nonblock(sockaddr) rescue Errno::EISCONN end end sock end