acks is a number

This commit is contained in:
andreas
2012-09-22 17:51:45 +00:00
parent 22016285e3
commit 1df065cf9b
+9 -6
View File
@@ -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="<b>%s</b>" % 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=""