Class: Droonga::FluentMessageReceiver::HeartbeatReceiver
- Inherits:
-
Object
- Object
- Droonga::FluentMessageReceiver::HeartbeatReceiver
- Defined in:
- lib/droonga/fluent_message_receiver.rb
Instance Method Summary collapse
-
#initialize(loop, fd) ⇒ HeartbeatReceiver
constructor
A new instance of HeartbeatReceiver.
- #shutdown ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(loop, fd) ⇒ HeartbeatReceiver
Returns a new instance of HeartbeatReceiver.
111 112 113 114 |
# File 'lib/droonga/fluent_message_receiver.rb', line 111 def initialize(loop, fd) @loop = loop @fd = fd end |
Instance Method Details
#shutdown ⇒ Object
129 130 131 132 |
# File 'lib/droonga/fluent_message_receiver.rb', line 129 def shutdown @socket.close @watcher.detach end |
#start ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/droonga/fluent_message_receiver.rb', line 116 def start @socket = UDPSocket.for_fd(@fd) @watcher = Coolio::IOWatcher.new(@socket, "r") on_readable = lambda do receive_heartbeat end @watcher.on_readable do on_readable.call end @loop.attach(@watcher) end |