class Thrift::SSLSocket

Attributes

ssl_context[RW]

Public Class Methods

new(host='localhost', port=9090, timeout=nil, ssl_context=nil) click to toggle source
# File lib/thrift/transport/ssl_socket.rb, line 21
def initialize(host='localhost', port=9090, timeout=nil, ssl_context=nil)
  super(host, port, timeout)
  @ssl_context = ssl_context
end

Public Instance Methods

open() click to toggle source
# File lib/thrift/transport/ssl_socket.rb, line 28
def open
  socket = super
  @handle = OpenSSL::SSL::SSLSocket.new(socket, @ssl_context)
  begin
    @handle.connect_nonblock
    @handle.post_connection_check(@host)
    @handle
  rescue IO::WaitReadable
    IO.select([ @handle ], nil, nil, @timeout)
    retry
  rescue IO::WaitWritable
    IO.select(nil, [ @handle ], nil, @timeout)
    retry
  rescue StandardError => e
    raise TransportException.new(TransportException::NOT_OPEN, "Could not connect to #{@desc}: #{e}")
  end
end