Commits

Dave Cheney committed 3d83d99

latest changes

Comments (0)

Files changed (2)

lib/heartbeat/host.rb

   end
   
   def to_s
-    "#{id} [Area:#{area}, Zone:#{zone}] #{super.to_s}"
+    "#{addr} [Area:#{area}, Zone:#{zone}] #{super.to_s}"
   end
   
 end
   def announce(host_addr)
     addr = IPAddr.new(host_addr, Socket::AF_INET)
     timed = @hosts[addr]
-    unless timed then
+    if timed then
+      timed.reset!
+    else
       host = Host.new(addr)
       timed = Timed.new(host)
       @hosts[addr] = timed
       # announce host
     end
-    timed.reset!
+    timed.value
   end
   
   def expire
-    
+    @hosts.each_value { |t| awol(t.value) if t.expired? }
   end
   
+  def awol(host)
+    puts "Host #{host} marked as awol"
+  end
     
 end

lib/heartbeat/timer.rb

   
   def initialize(seconds) 
     @seconds = seconds
+    reset!
   end
   
   def reset!