Class: Fluent::UdpHandler

Inherits:
SocketUtil::UdpHandler
  • Object
show all
Defined in:
lib/fluent/plugin/in_gelf.rb

Instance Method Summary collapse

Constructor Details

#initialize(io, log, body_size_limit, callback) ⇒ UdpHandler

Returns a new instance of UdpHandler.



14
15
16
# File 'lib/fluent/plugin/in_gelf.rb', line 14

def initialize(io, log, body_size_limit, callback)
 super
end

Instance Method Details

#on_readableObject



17
18
19
20
21
22
# File 'lib/fluent/plugin/in_gelf.rb', line 17

def on_readable
  msg, addr = @io.recvfrom_nonblock(@body_size_limit)
  @callback.call(msg, addr)
rescue => e
  @log.error "unexpected error", error: e, error_class: e.class
end