lib/em-ssh/connection.rb
# Register the primary :data callback
# @return [Callback] the callback that was registered
Register the primary :data callback
Register the primary : data callback
def register_data_handler
        on(:data) do |data|
          while (packet = @socket.poll_next_packet)
            case packet.type
            when DISCONNECT
              @disconnect = packet
              close_connection
            when IGNORE
              debug("IGNORE packet received: #{packet[:data].inspect}")
            when UNIMPLEMENTED
              log.warn("UNIMPLEMENTED: #{packet[:number]}")
            when DEBUG
              log.send((packet[:always_display] ? :fatal : :debug), packet[:message])
            when KEXINIT
              Fiber.new do
                begin
                  algorithms.accept_kexinit(packet)
                  fire(:algo_init) if algorithms.initialized?
                rescue Exception => e
                  fire(:error, e)
                end 
              end.resume
            else
              @queue.push(packet) unless packet.type >= CHANNEL_OPEN
              if algorithms.allow?(packet)
                fire(:packet, packet)
                fire(:session_packet, packet) if packet.type >= GLOBAL_REQUEST
              end 
              socket.consume!
            end 
          end 
        end 
      end
def register_data_handler on ( :data ) do | data | while ( packet = @socket . poll_next_packet ) case packet . type when DISCONNECT @disconnect = packet close_connection when IGNORE debug ( "IGNORE packet received: #{packet[:data].inspect}" ) when UNIMPLEMENTED log . warn ( "UNIMPLEMENTED: #{packet[:number]}" ) when DEBUG log . send ( ( packet [ :always_display ] ? :fatal : :debug ) , packet [ :message ] ) when KEXINIT Fiber . new do begin algorithms . accept_kexinit ( packet ) fire ( :algo_init ) if algorithms . initialized? rescue Exception => e fire ( :error , e ) end end . resume else @queue . push ( packet ) unless packet . type >= CHANNEL_OPEN if algorithms . allow? ( packet ) fire ( :packet , packet ) fire ( :session_packet , packet ) if packet . type >= GLOBAL_REQUEST end socket . consume! end end end end
Register the primary :data callback
Register the primary : data callback
# begin # algorithms.allow?(packet) # packet.type # (packet = @socket.poll_next_packet) #  |data|
the callback that was registered
the callback that was registered
Callback