class Thrift::SSLSocket

Attributes

ssl_context[RW]

Public Class Methods

new(host='localhost', port=9090, timeout=nil, ssl_context=nil) click to toggle source
Calls superclass method Thrift::Socket::new
   # File lib/thrift/transport/ssl_socket.rb
22 def initialize(host='localhost', port=9090, timeout=nil, ssl_context=nil)
23   super(host, port, timeout)
24   @ssl_context = ssl_context
25 end

Public Instance Methods

open() click to toggle source
Calls superclass method Thrift::Socket#open
   # File lib/thrift/transport/ssl_socket.rb
29 def open
30   socket = super
31   @handle = OpenSSL::SSL::SSLSocket.new(socket, @ssl_context)
32   begin
33     @handle.connect_nonblock
34     @handle.post_connection_check(@host)
35     @handle
36   rescue IO::WaitReadable
37     IO.select([ @handle ], nil, nil, @timeout)
38     retry
39   rescue IO::WaitWritable
40     IO.select(nil, [ @handle ], nil, @timeout)
41     retry
42   rescue StandardError => e
43     raise TransportException.new(TransportException::NOT_OPEN, "Could not connect to #{@desc}: #{e}")
44   end
45 end
to_s() click to toggle source
   # File lib/thrift/transport/ssl_socket.rb
47 def to_s
48   "ssl(#{super.to_s})"
49 end