Sha256: 953294d12584d185341364ac5eccc5caa92c9e6b592e725e14d28511d273b92c

Contents?: true

Size: 428 Bytes

Versions: 1

Compression:

Stored size: 428 Bytes

Contents

require 'eventmachine'

module Collectd
  class EmServer < Values

    def initialize(interval, host, port)
      super(interval)
      @sock = UDPSocket.new(host.index(':') ? Socket::AF_INET6 : Socket::AF_INET)
      @sock.connect(host, port)

      EM.add_periodic_timer(interval) do
        Thread.critical = true
        pkt = make_pkt
        Thread.critical = false
        @sock.send(pkt, 0)
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
astro-collectd-0.0.4 lib/collectd/em_server.rb