fix bogus notification on new clients

This commit is contained in:
Andreas Wrede
2026-04-10 13:39:18 -04:00
parent 2468386f24
commit 6217f7a124
2 changed files with 17 additions and 7 deletions
+7
View File
@@ -426,6 +426,13 @@ async def _run_async(config, config_path=None):
except Exception as e: except Exception as e:
logger.warning("Error stopping DNS worker: %s", e) logger.warning("Error stopping DNS worker: %s", e)
# Save state (hosts + sessions) on clean shutdown
try:
save_state(config, hbdclass)
logger.info("State saved on shutdown")
except Exception as e:
logger.warning("Error saving state on shutdown: %s", e)
logger.info("All tasks cancelled") logger.info("All tasks cancelled")
+3
View File
@@ -412,6 +412,9 @@ def handle_datagram(msg: dict, addr, transport, ctx: dict):
if conn.getstate() != hbdcls.Connection.UP: if conn.getstate() != hbdcls.Connection.UP:
lasts = conn.state lasts = conn.state
d = conn.newstate(hbdcls.Connection.UP, now) d = conn.newstate(hbdcls.Connection.UP, now)
# Don't log/notify RECOVER for a brand-new host seen for the first time —
# it was never down, it just hasn't been seen before.
if not newh:
if d == 0 or lasts == "unknown": if d == 0 or lasts == "unknown":
m = "%s is up" % (conn.afam) m = "%s is up" % (conn.afam)
else: else: