module Net::SSH::Transport::PacketStream
def next_packet(mode=:nonblock)
returned. If the mode parameter is :block, then this method will block
available or not, and will return nil if there is no packet ready to be
default), then this will return immediately, whether a packet is
Returns the next full packet. If the mode parameter is :nonblock (the
def next_packet(mode=:nonblock) case mode when :nonblock then if available_for_read? if fill <= 0 raise Net::SSH::Disconnect, "connection closed by remote host" end end poll_next_packet when :block then loop do packet = poll_next_packet return packet if packet loop do result = Net::SSH::Compat.io_select([self]) or next break if result.first.any? end if fill <= 0 raise Net::SSH::Disconnect, "connection closed by remote host" end end else raise ArgumentError, "expected :block or :nonblock, got #{mode.inspect}" end end