Sha256: 83505e78f7d477bd31e26421fe55eeab76a4e86b6259bfabd6aca1ee350e8c1a
Contents?: true
Size: 768 Bytes
Versions: 3
Compression:
Stored size: 768 Bytes
Contents
module EventMachine module SFlow module DatagramHandler def initialize args @host = args[:host] @callbacks = args[:callbacks] @proxy_targets = args[:proxy_targets] end def receive_data data unless @proxy_targets.empty? @proxy_socket ||= EventMachine.open_datagram_socket(@host, 0) @proxy_targets.each do |target| target_host = target.split(":")[0] target_port = target.split(":")[1] || "6343" @proxy_socket.send_datagram(data, target_host, target_port) end end datagram = Datagram.new(data) @callbacks.each do |callback| callback.call datagram end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
em-sflow-1.0.3 | lib/em-sflow/datagram_handler.rb |
em-sflow-1.0.2 | lib/em-sflow/datagram_handler.rb |
em-sflow-1.0.1 | lib/em-sflow/datagram_handler.rb |