class Puma::Cluster::Worker

def boot!

def boot!
  @last_checkin = Time.now
  @stage = :booted
end

def booted?

def booted?
  @stage == :booted
end

def hup

def hup
  Process.kill "HUP", @pid
rescue Errno::ESRCH
end

def initialize(idx, pid, phase, options)

def initialize(idx, pid, phase, options)
  @index = idx
  @pid = pid
  @phase = phase
  @stage = :started
  @signal = "TERM"
  @options = options
  @first_term_sent = nil
  @started_at = Time.now
  @last_checkin = Time.now
  @last_status = '{}'
  @term = false
end

def kill

def kill
  Process.kill "KILL", @pid
rescue Errno::ESRCH
end

def ping!(status)

def ping!(status)
  @last_checkin = Time.now
  @last_status = status
end

def ping_timeout?(which)

def ping_timeout?(which)
  Time.now - @last_checkin > which
end

def term

def term
  begin
    if @first_term_sent && (Time.now - @first_term_sent) > @options[:worker_shutdown_timeout]
      @signal = "KILL"
    else
      @term ||= true
      @first_term_sent ||= Time.now
    end
    Process.kill @signal, @pid
  rescue Errno::ESRCH
  end
end

def term?

def term?
  @term
end