Sha256: a063124ca5a4c2fbf7b7c7d71baa061a0beb516f01e595178057402bb0a68d01
Contents?: true
Size: 729 Bytes
Versions: 14
Compression:
Stored size: 729 Bytes
Contents
module Kurchatov module Responders class Udp < Kurchatov::Plugin include Kurchatov::Mixin::Event include Kurchatov::Mixin::Queue def initialize(conn) @host, @port = conn.split(':') @name = "udp responder #{@host}:#{@port}" end def run 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
14 entries across 14 versions & 1 rubygems