From 1df065cf9b4a0d40f9dc3485d53159148b549405 Mon Sep 17 00:00:00 2001 From: andreas Date: Sat, 22 Sep 2012 17:51:45 +0000 Subject: [PATCH] acks is a number --- hbd | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hbd b/hbd index 69ad957..6997971 100755 --- a/hbd +++ b/hbd @@ -1,5 +1,5 @@ #!/usr/bin/env python -# $Id: hbd,v 1.32 2012/09/22 17:51:16 andreas Exp $ +# $Id: hbd,v 1.33 2012/09/22 17:51:45 andreas Exp $ # Wait for heartbeat messages and act on them (or their absence) # import time, os, string, sys, socket, atexit, select, SocketServer, getopt, signal, cPickle, smtplib, traceback @@ -71,7 +71,7 @@ class Host: self.state="up" self.statetime=self.lastbeat self.interval=0 - self.doesack="" + self.doesack=-1 num+=1 def getstate(self): @@ -82,7 +82,7 @@ class Host: state="%s" % self.state else: state="%s" % self.state - if self.doesack != "": + if self.doesack != -1: return "%s(%s)" % (state, self.doesack) return state @@ -345,7 +345,7 @@ def readsock(): msg=None interval=0 deltaT=0.0 - acks="" + acks=-1 for pair in pairs: l=string.split(pair,"=") key=l[0] @@ -371,10 +371,13 @@ def readsock(): except: pass elif key == 'acks': - acks=val + try: + acks=int(val) + except: + acks=-1 if boot: - if acks != "": + if acks == -1: a="(%s)" % acks else: a=""