place dnsq

This commit is contained in:
2016-04-27 09:19:38 +02:00
parent 714570636f
commit 6e4273ef77
2 changed files with 8 additions and 7 deletions
+4 -4
View File
@@ -336,7 +336,7 @@ def log(host, m, service=None):
def dnsupdatethread():
while True:
name, addr = dnsQ.get()
name, addr = Host.dnsQ.get()
m = "changed address to %s" % (addr)
err = nsupdate(name, addr)
if err:
@@ -344,7 +344,7 @@ def dnsupdatethread():
email("error: nsupdate failed", "%s: %s" % (name, m))
else:
m += ", DNS updated."
dnsQ.task_done()
Host.dnsQ.task_done()
log(name, m)
#
@@ -407,7 +407,7 @@ def readsock(sock):
email("address change", "%s %s" % (host.name, res))
pushover("%s %s" % (host.name, res))
if conn.getstate() != Connection.up and interval > 0:
if conn.getstate() != Connection.up: # XXX and interval > 0:
lasts = conn.state
d = conn.newstate(Connection.up, now)
m = "%s back after being %s for %s" % (conn.afam, lasts, dur(d))
@@ -960,7 +960,7 @@ servthread = threading.Thread(target=serv.serve_forever)
servthread.daemon = True
servthread.start()
dnsQ = Queue.Queue()
Host.dnsQ = Queue.Queue()
dnsT = threading.Thread(target=dnsupdatethread)
dnsT.daemon = True
dnsT.start()