From c295c941e9f0cdf1f3f568a1f52f7c35dc3e9b70 Mon Sep 17 00:00:00 2001 From: torque Date: Thu, 18 Jul 2024 19:43:06 -0700 Subject: [PATCH] rotctl: actually quit when receiving the quit message --- src/RotCtl.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/RotCtl.zig b/src/RotCtl.zig index da019e8..3dffebc 100644 --- a/src/RotCtl.zig +++ b/src/RotCtl.zig @@ -33,7 +33,7 @@ pub fn run(allocator: std.mem.Allocator) !void { .rotator = try YaesuController.init(allocator), }; - while (true) { + while (interface.running) { const client = try server.accept(); defer { log.info("disconnecting client", .{}); @@ -43,8 +43,6 @@ pub fn run(allocator: std.mem.Allocator) !void { } interface.writer = .{ .unbuffered_writer = client.stream.writer() }; - interface.running = true; - defer interface.running = false; log.info("client connected from {}", .{client.address}); @@ -66,6 +64,8 @@ pub fn run(allocator: std.mem.Allocator) !void { if (interface.running and config.rotctl.autopark) interface.rotator.startPark(); } + + interface.rotator.control_thread.join(); } fn write(self: *RotCtl, buf: []const u8) !void {