Class: Thrift::SSLServerSocket

Inherits:
ServerSocket show all
Defined in:
lib/thrift/transport/ssl_server_socket.rb

Constant Summary

Constants inherited from BaseServerTransport

BaseServerTransport::DEFAULT_CLIENT_TIMEOUT

Instance Attribute Summary collapse

Attributes inherited from ServerSocket

#client_timeout, #handle

Instance Method Summary collapse

Methods inherited from ServerSocket

#accept, #close, #closed?, #to_io

Methods inherited from BaseServerTransport

#accept, #close, #closed?

Constructor Details

#initialize(host_or_port, port = nil, ssl_context = nil, client_timeout: DEFAULT_CLIENT_TIMEOUT) ⇒ SSLServerSocket

Returns a new instance of SSLServerSocket.



26
27
28
29
# File 'lib/thrift/transport/ssl_server_socket.rb', line 26

def initialize(host_or_port, port = nil, ssl_context = nil, client_timeout: DEFAULT_CLIENT_TIMEOUT)
  super(host_or_port, port, client_timeout: client_timeout)
  @ssl_context = ssl_context
end

Instance Attribute Details

#ssl_contextObject

Returns the value of attribute ssl_context.



31
32
33
# File 'lib/thrift/transport/ssl_server_socket.rb', line 31

def ssl_context
  @ssl_context
end

Instance Method Details

#listenObject



33
34
35
36
# File 'lib/thrift/transport/ssl_server_socket.rb', line 33

def listen
  socket = TCPServer.new(@host, @port)
  @handle = OpenSSL::SSL::SSLServer.new(socket, @ssl_context)
end

#to_sObject



38
39
40
# File 'lib/thrift/transport/ssl_server_socket.rb', line 38

def to_s
  "ssl(#{super.to_s})"
end