# File lib/net/ssh/transport/packet_stream.rb, line 82 def next_packet(mode=:nonblock) case mode when :nonblock then fill if available_for_read? 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