Class: Fluent::Plugin::HttpInput::KeepaliveManager

Inherits:
Coolio::TimerWatcher
  • Object
show all
Defined in:
lib/fluent/plugin/in_http.rb

Instance Method Summary collapse

Constructor Details

#initialize(timeout) ⇒ KeepaliveManager

Returns a new instance of KeepaliveManager.



93
94
95
96
97
# File 'lib/fluent/plugin/in_http.rb', line 93

def initialize(timeout)
  super(1, true)
  @cons = {}
  @timeout = timeout.to_i
end

Instance Method Details

#add(sock) ⇒ Object



99
100
101
# File 'lib/fluent/plugin/in_http.rb', line 99

def add(sock)
  @cons[sock] = sock
end

#delete(sock) ⇒ Object



103
104
105
# File 'lib/fluent/plugin/in_http.rb', line 103

def delete(sock)
  @cons.delete(sock)
end

#on_timerObject



107
108
109
110
111
112
113
# File 'lib/fluent/plugin/in_http.rb', line 107

def on_timer
  @cons.each_pair {|sock,val|
    if sock.step_idle > @timeout
      sock.close
    end
  }
end