class Net::SSH::Transport::Session
def poll_message(mode = :nonblock, consume_queue = true)
is not in process, and consume_queue is true, packets will be first
received, it will be enqueued and otherwise ignored. When a key-exchange
If a key-exchange is in process and a disallowed packet type is
be returned.
DEBUG, and KEXINIT) are handled silently by this method, and will never
available. Note that some packet types (DISCONNECT, IGNORE, UNIMPLEMENTED,
waiting to be read. Otherwise, this will block until a packet is
default), this will not block and will return nil if there are no packets
Tries to read the next packet from the socket. If mode is :nonblock (the
def poll_message(mode = :nonblock, consume_queue = true) loop do return @queue.shift if consume_queue && @queue.any? && algorithms.allow?(@queue.first) packet = socket.next_packet(mode, options[:timeout]) return nil if packet.nil? case packet.type when DISCONNECT raise Net::SSH::Disconnect, "disconnected: #{packet[:description]} (#{packet[:reason_code]})" when IGNORE debug { "IGNORE packet received: #{packet[:data].inspect}" } when UNIMPLEMENTED lwarn { "UNIMPLEMENTED: #{packet[:number]}" } when DEBUG send(packet[:always_display] ? :fatal : :debug) { packet[:message] } when KEXINIT algorithms.accept_kexinit(packet) else return packet if algorithms.allow?(packet) push(packet) end end end