Class: Fluent::ForwardInput::HeartbeatRequestHandler
- Inherits:
-
Coolio::IO
- Object
- Coolio::IO
- Fluent::ForwardInput::HeartbeatRequestHandler
- Defined in:
- lib/fluent/plugin/in_forward.rb
Instance Method Summary collapse
-
#initialize(io, callback) ⇒ HeartbeatRequestHandler
constructor
A new instance of HeartbeatRequestHandler.
- #on_readable ⇒ Object
Constructor Details
#initialize(io, callback) ⇒ HeartbeatRequestHandler
Returns a new instance of HeartbeatRequestHandler.
338 339 340 341 342 |
# File 'lib/fluent/plugin/in_forward.rb', line 338 def initialize(io, callback) super(io) @io = io @callback = callback end |
Instance Method Details
#on_readable ⇒ Object
344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/fluent/plugin/in_forward.rb', line 344 def on_readable begin msg, addr = @io.recvfrom(1024) rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR return end host = addr[3] port = addr[1] @callback.call(host, port, msg) rescue # TODO log? end |