Class: Redis::Connection::SSL::Socket

Inherits:
OpenSSL::SSL::SSLSocket
  • Object
show all
Includes:
Redis::Connection::SocketMixin
Defined in:
lib/redis/connection/ssl.rb

Overview

Socket class

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.connect(host, port, timeout) ⇒ Object

Socket.connect



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/redis/connection/ssl.rb', line 30

def self.connect(host, port, timeout)
  tcp = ::TCPSocket.new(host, port)
  tcp.setsockopt ::Socket::IPPROTO_TCP, ::Socket::TCP_NODELAY, 1

  ssl = new(tcp)
  begin
    ssl.connect
  rescue Errno::EINPROGRESS
    if IO.select(nil, [ssl], nil, timeout) == nil
      raise Redis::TimeoutError
    end

    begin
      ssl.connect
    rescue Errno::EISCONN
    end
  end

  ssl
end

Instance Method Details

#_read_from_socketObject

Override, catch SSL blocks



25
26
27
# File 'lib/redis/connection/ssl.rb', line 25

def _read_from_socket(*)
  Redis::Connection::SSL.retry_on_would_block(self, @timeout) { super }
end