Class: Fluent::ForwardOutput::HeartbeatHandler
- Inherits:
-
Coolio::IO
- Object
- Coolio::IO
- Fluent::ForwardOutput::HeartbeatHandler
- Defined in:
- lib/fluent/plugin/out_forward.rb
Instance Method Summary collapse
-
#initialize(io, callback) ⇒ HeartbeatHandler
constructor
A new instance of HeartbeatHandler.
- #on_readable ⇒ Object
Constructor Details
#initialize(io, callback) ⇒ HeartbeatHandler
Returns a new instance of HeartbeatHandler.
415 416 417 418 419 |
# File 'lib/fluent/plugin/out_forward.rb', line 415 def initialize(io, callback) super(io) @io = io @callback = callback end |
Instance Method Details
#on_readable ⇒ Object
421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'lib/fluent/plugin/out_forward.rb', line 421 def on_readable begin msg, addr = @io.recvfrom(1024) rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR return end host = addr[3] port = addr[1] sockaddr = Socket.pack_sockaddr_in(port, host) @callback.call(sockaddr, msg) rescue # TODO log? end |