Class: Fluent::Plugin::HttpInput::KeepaliveManager
- Inherits:
-
Coolio::TimerWatcher
- Object
- Coolio::TimerWatcher
- Fluent::Plugin::HttpInput::KeepaliveManager
- Defined in:
- lib/fluent/plugin/in_http.rb
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.
141 142 143 144 145 |
# File 'lib/fluent/plugin/in_http.rb', line 141 def initialize(timeout) super(1, true) @cons = {} @timeout = timeout.to_i end |
Instance Method Details
#add(sock) ⇒ Object
147 148 149 |
# File 'lib/fluent/plugin/in_http.rb', line 147 def add(sock) @cons[sock] = sock end |
#delete(sock) ⇒ Object
151 152 153 |
# File 'lib/fluent/plugin/in_http.rb', line 151 def delete(sock) @cons.delete(sock) end |
#on_timer ⇒ Object
155 156 157 158 159 160 161 |
# File 'lib/fluent/plugin/in_http.rb', line 155 def on_timer @cons.each_pair {|sock,val| if sock.step_idle > @timeout sock.close end } end |