cleanup
This commit is contained in:
+17
-16
@@ -7,6 +7,7 @@ the websit's heartbeat.py
|
||||
import time
|
||||
import json
|
||||
import copy
|
||||
import queue
|
||||
|
||||
num = 0
|
||||
|
||||
@@ -41,7 +42,6 @@ class Connection:
|
||||
self.state = Connection.unknown
|
||||
|
||||
if host:
|
||||
r = "new addr %s" % (addr)
|
||||
Connection.htab[addr] = self.host.name
|
||||
if self.host.isDynDns():
|
||||
log(self.host.name, "dns update %s" % self.addr)
|
||||
@@ -154,6 +154,7 @@ class Connection:
|
||||
class Host:
|
||||
# Table of Hosts
|
||||
hosts = {}
|
||||
dnsQ = queue.Queue()
|
||||
|
||||
def __init__(self, name):
|
||||
global num
|
||||
@@ -255,21 +256,21 @@ class Host:
|
||||
def fixup(self):
|
||||
pass
|
||||
|
||||
def dispstate(self):
|
||||
if self.state in ["down", "overdue"]:
|
||||
state = "<b>%s</b>" % self.state
|
||||
elif self.state in ["up", "UP"]:
|
||||
state = ""
|
||||
for x in list(self.connections.keys()):
|
||||
try:
|
||||
state += " %5.1f" % (self.connections[x].rtts[-1])
|
||||
except:
|
||||
state += " %5s" % (self.connections[x].rtts[-1])
|
||||
elif self.state in ["unknown", "UNKNOWN"]:
|
||||
state = ""
|
||||
else:
|
||||
state = "%s" % self.state
|
||||
return state
|
||||
#def dispstate(self):
|
||||
# if self.state in ["down", "overdue"]:
|
||||
# state = "<b>%s</b>" % self.state
|
||||
# elif self.state in ["up", "UP"]:
|
||||
# state = ""
|
||||
# for x in list(self.connections.keys()):
|
||||
# try:
|
||||
# state += " %5.1f" % (self.connections[x].rtts[-1])
|
||||
# except:
|
||||
# state += " %5s" % (self.connections[x].rtts[-1])
|
||||
# elif self.state in ["unknown", "UNKNOWN"]:
|
||||
# state = ""
|
||||
# else:
|
||||
# state = "%s" % self.state
|
||||
# return state
|
||||
|
||||
def dispstats(self):
|
||||
if self.doesack != -1:
|
||||
|
||||
Reference in New Issue
Block a user