Class: HrrRbSftp::Protocol::Version1::Packets::SSH_FXP_CLOSE
- Inherits:
-
Packet
- Object
- Common::Packets::Packet
- Packet
- HrrRbSftp::Protocol::Version1::Packets::SSH_FXP_CLOSE
- Defined in:
- lib/hrr_rb_sftp/protocol/version1/packets/004_ssh_fxp_close.rb
Overview
This class implements SFTP protocol version 1 SSH_FXP_CLOSE packet type, format, and responder.
Constant Summary collapse
- TYPE =
Represents SSH_FXP_CLOSE packet type.
4
- FORMAT =
Represents SSH_FXP_CLOSE packet format.
[ [DataTypes::Byte, :"type" ], [DataTypes::Uint32, :"request-id"], [DataTypes::String, :"handle" ], ]
Instance Attribute Summary
Attributes included from Loggable
Instance Method Summary collapse
-
#respond_to(request) ⇒ Hash{Symbol=>Object}
Responds to SSH_FXP_CLOSE request.
Methods inherited from Packet
#context, #handles, #initialize, #version
Methods inherited from Common::Packets::Packet
Methods included from Loggable
#log_debug, #log_error, #log_fatal, #log_info, #log_warn
Constructor Details
This class inherits a constructor from HrrRbSftp::Protocol::Version1::Packets::Packet
Instance Method Details
#respond_to(request) ⇒ Hash{Symbol=>Object}
Responds to SSH_FXP_CLOSE request.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/hrr_rb_sftp/protocol/version1/packets/004_ssh_fxp_close.rb', line 31 def respond_to request begin raise "Specified handle does not exist" unless handles.has_key?(request[:"handle"]) handle = request[:"handle"] log_debug { "handles[#{handle.inspect}].close" } handles[handle].close rescue nil log_debug { "handles.delete(#{handle.inspect})" } handles.delete(handle) { :"type" => SSH_FXP_STATUS::TYPE, :"request-id" => request[:"request-id"], :"code" => SSH_FXP_STATUS::SSH_FX_OK, :"error message" => "Success", :"language tag" => "", } rescue => e log_error { [e.backtrace[0], ": ", e., " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join } { :"type" => SSH_FXP_STATUS::TYPE, :"request-id" => request[:"request-id"], :"code" => SSH_FXP_STATUS::SSH_FX_FAILURE, :"error message" => e., :"language tag" => "", } end end |