module Net::SCP::Download

def finish_read_state(channel)

server to indicate that the file was recieved successfully.
#read_directive_state (for recursive downloads). A 0-byte is sent to the
jumps to either #finish_state (for single-file downloads) or
Finishes off the read, sets the times for the file (if any), and then
def finish_read_state(channel)
  channel[:io].close unless channel[:io] == channel[:local]
  if channel[:options][:preserve] && channel[:file][:times]
    File.utime(channel[:file][:times][:atime],
      channel[:file][:times][:mtime], channel[:file][:name])
  end
  channel[:file] = nil
  channel[:state] = channel[:stack].empty? ? :finish : :read_directive
  channel.send_data("\0")
end