Class: Arpoon::Interface::Handler

Inherits:
EM::Connection
  • Object
show all
Defined in:
lib/arpoon/interface.rb

Instance Method Summary collapse

Constructor Details

#initialize(interface) ⇒ Handler

Returns a new instance of Handler.



19
20
21
# File 'lib/arpoon/interface.rb', line 19

def initialize (interface)
	@interface = interface
end

Instance Method Details

#notify_readableObject



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/arpoon/interface.rb', line 23

def notify_readable (*)
	@interface.capture.dispatch {|_, packet|
		begin
			next unless packet = Packet.unpack(packet.body, @interface) rescue nil

			@interface.fire :packet, packet
		rescue Exception => e
			Arpoon.log e, "interface: #{@interface.name}"
		end
	}
end