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.
177 178 179 180 181 |
# File 'lib/fluent/plugin/in_http.rb', line 177 def initialize(timeout) super(1, true) @cons = {} @timeout = timeout.to_i end |
Instance Method Details
#add(sock) ⇒ Object
183 184 185 |
# File 'lib/fluent/plugin/in_http.rb', line 183 def add(sock) @cons[sock] = sock end |
#delete(sock) ⇒ Object
187 188 189 |
# File 'lib/fluent/plugin/in_http.rb', line 187 def delete(sock) @cons.delete(sock) end |
#on_timer ⇒ Object
191 192 193 194 195 196 197 |
# File 'lib/fluent/plugin/in_http.rb', line 191 def on_timer @cons.each_pair {|sock,val| if sock.step_idle > @timeout sock.close end } end |