Class: Fluent::HttpListInput::KeepaliveManager
- Inherits:
-
Coolio::TimerWatcher
- Object
- Coolio::TimerWatcher
- Fluent::HttpListInput::KeepaliveManager
- Defined in:
- lib/fluent/plugin/in_http_list.rb
Defined Under Namespace
Classes: TimerValue
Instance Method Summary collapse
- #add(sock) ⇒ Object
- #delete(sock) ⇒ Object
-
#initialize(timeout) ⇒ KeepaliveManager
constructor
A new instance of KeepaliveManager.
- #on_timer ⇒ Object
Constructor Details
#initialize(timeout) ⇒ KeepaliveManager
Returns a new instance of KeepaliveManager.
32 33 34 35 36 |
# File 'lib/fluent/plugin/in_http_list.rb', line 32 def initialize(timeout) super(1, true) @cons = {} @timeout = timeout.to_i end |
Instance Method Details
#add(sock) ⇒ Object
38 39 40 |
# File 'lib/fluent/plugin/in_http_list.rb', line 38 def add(sock) @cons[sock] = sock end |
#delete(sock) ⇒ Object
42 43 44 |
# File 'lib/fluent/plugin/in_http_list.rb', line 42 def delete(sock) @cons.delete(sock) end |
#on_timer ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/fluent/plugin/in_http_list.rb', line 46 def on_timer @cons.each_pair {|sock,val| if sock.step_idle > @timeout sock.close end } end |