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