Method: Ftpd::Session#initialize

Defined in:
lib/ftpd/session.rb

#initialize(session_config, socket) ⇒ Session

Returns a new instance of Session.

Parameters:

  • socket (TCPSocket, OpenSSL::SSL::SSLSocket)

    The socket



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ftpd/session.rb', line 29

def initialize(session_config, socket)
  @config = session_config
  @socket = socket
  if @config.tls == :implicit
    @socket.encrypt
  end
  @command_sequence_checker = init_command_sequence_checker
  set_socket_options
  @protocols = Protocols.new(@socket)
  @command_handlers = CommandHandlers.new
  @command_loop = CommandLoop.new(self)
  @data_server_factory = DataServerFactory.make(
    @socket.addr[3],
    config.passive_ports,
  )
  register_commands
  initialize_session
end