From d9fc8d632fe9a72c94ee3ff8efd41f84bc10e30f Mon Sep 17 00:00:00 2001 From: Andreas Wrede Date: Wed, 6 May 2026 11:54:09 -0400 Subject: [PATCH] send shutdown msg only if we sent a boot msg. Don't send eithe when restarting. --- hbd/client/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hbd/client/main.py b/hbd/client/main.py index ea3f230..15ee92f 100644 --- a/hbd/client/main.py +++ b/hbd/client/main.py @@ -463,7 +463,7 @@ async def cleanup(connections: List[AsyncConnection]): logger.info("Cleaning up connections") target = next((c for c in connections if c.transport), connections[0] if connections else None) - if target: + if target and send_shutdown: try: await target.sendto({"shutdown": 1, "acks": target.ackcount}) except Exception as e: @@ -477,7 +477,7 @@ async def cleanup(connections: List[AsyncConnection]): async def async_main(args, config): """Async main function.""" - global running, shutdown_event, active_tasks + global running, shutdown_event, active_tasks, send_shutdown # Create shutdown event shutdown_event = asyncio.Event() @@ -525,10 +525,13 @@ async def async_main(args, config): logger.info(f"Created {len(connections)} connections") # Send boot/message if requested + send_shutdown = False if args.boot or args.message: boot_msg = {} if args.boot: boot_msg["boot"] = 1 + args.boot = False # Clear boot flag so we don't send it again in main loop + send_shutdown = True if args.message: boot_msg["service"] = "service" boot_msg["msg"] = args.message