Class: Redis::Connection::SSL
- Inherits:
-
Ruby
- Object
- Ruby
- Redis::Connection::SSL
- Defined in:
- lib/redis/connection/ssl.rb
Defined Under Namespace
Classes: Socket
Class Method Summary collapse
-
.connect(config) ⇒ Object
Connect method.
-
.retry_on_would_block(sock, timeout) ⇒ Object
::OpenSSL::SSL::SSLSocket doesn’t raise Errno::EWOULDBLOCK Helper to catch blocks.
Class Method Details
.connect(config) ⇒ Object
Connect method
54 55 56 57 58 59 60 61 |
# File 'lib/redis/connection/ssl.rb', line 54 def self.connect(config) return super unless config[:scheme] == "redis+ssl" sock = self::Socket.connect(config[:host], config[:port], config[:timeout]) instance = new(sock) instance.timeout = config[:timeout] instance end |
.retry_on_would_block(sock, timeout) ⇒ Object
::OpenSSL::SSL::SSLSocket doesn’t raise Errno::EWOULDBLOCK Helper to catch blocks
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/redis/connection/ssl.rb', line 8 def self.retry_on_would_block(sock, timeout) yield rescue ::OpenSSL::SSL::SSLError => e if e. !~ /would block/ raise elsif IO.select([sock], nil, nil, timeout) retry else raise Redis::TimeoutError end end |