Sha256: e6c15516dc36169e4ef4a7fa0009b17e6c9f7ae5186a64c51707371832aefd94
Contents?: true
Size: 779 Bytes
Versions: 1
Compression:
Stored size: 779 Bytes
Contents
module Kurchatov module Responders class Udp < Kurchatov::Plugin include Kurchatov::Mixin::Event def initialize(conn) @host, @port = conn.split(':') @name = "udp responder #{@host}:#{@port}" end def plugin_config {:host => @host, :port => @port} end def run super Socket.udp_server_loop(@host, @port) do |data, src| process(data, src) end end def process(data, src) begin event(JSON.parse(data)) src.reply "sended\n\n" rescue => e src.reply "failed to send: #{data.inspect}\n" Log.error("Failed parse #{data.inspect}, #{e.class}: #{e}\n #{e.backtrace.join("\n")}") end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kurchatov-0.0.6 | lib/kurchatov/responders/udp.rb |