Class: HrrRbSftp::Server
- Inherits:
-
Object
- Object
- HrrRbSftp::Server
- Includes:
- Loggable
- Defined in:
- lib/hrr_rb_sftp/server.rb
Overview
This class implements SFTP server.
Instance Attribute Summary
Attributes included from Loggable
Instance Method Summary collapse
-
#initialize(logger: nil) ⇒ Server
constructor
A new instance of Server.
-
#start(io_in, io_out, io_err = nil) ⇒ Object
Starts SFTP server.
Methods included from Loggable
#log_debug, #log_error, #log_fatal, #log_info, #log_warn
Constructor Details
#initialize(logger: nil) ⇒ Server
Returns a new instance of Server.
19 20 21 |
# File 'lib/hrr_rb_sftp/server.rb', line 19 def initialize logger: nil self.logger = logger end |
Instance Method Details
#start(io_in, io_out, io_err = nil) ⇒ Object
Starts SFTP server.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/hrr_rb_sftp/server.rb', line 34 def start io_in, io_out, io_err=nil log_info { "start server" } @io_in = io_in @io_out = io_out @io_err = io_err @receiver = Receiver.new(@io_in) @sender = Sender.new(@io_out) @version = negotiate_version @protocol = Protocol.new(@version, logger: logger) begin respond_to_requests rescue => e log_error { [e.backtrace[0], ": ", e., " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join } raise ensure close_handles end log_info { "server finished" } end |