Method: Net::SSH::Connection::Channel#enqueue_pending_output

Defined in:
lib/net/ssh/connection/channel.rb

#enqueue_pending_outputObject

Enqueues pending output at the connection as CHANNEL_DATA packets. This does nothing if the channel has not yet been confirmed open (see #do_open_confirmation). This is called automatically by #process, which is called from the event loop (Connection::Session#process). You will generally not need to invoke it directly.



484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
# File 'lib/net/ssh/connection/channel.rb', line 484

def enqueue_pending_output #:nodoc:
  return unless remote_id

  while output.length > 0
    length = output.length
    length = remote_window_size if length > remote_window_size
    length = remote_maximum_packet_size if length > remote_maximum_packet_size

    if length > 0
      connection.send_message(Buffer.from(:byte, CHANNEL_DATA, :long, remote_id, :string, output.read(length)))
      output.consume!
      @remote_window_size -= length
    else
      break
    end
  end
end