rotctl: actually quit when receiving the quit message

This commit is contained in:
torque 2024-07-18 19:43:06 -07:00
parent de487d18c5
commit c295c941e9
Signed by: torque
SSH Key Fingerprint: SHA256:nCrXefBNo6EbjNSQhv0nXmEg/VuNq3sMF5b8zETw3Tk

View File

@ -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 {