Class: Fluent::HttpListInput::KeepaliveManager

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

Defined Under Namespace

Classes: TimerValue

Instance Method Summary collapse

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_timerObject



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