From 733831c30e541650d02aaef8198abebc073c95f8 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 30 Apr 2025 14:46:47 +0200 Subject: [PATCH 1/2] fix: release fd from stream_descriptor to prevent double or prematurely close --- src/executor_asio.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/executor_asio.cpp b/src/executor_asio.cpp index 4cdbc7c..8c084a4 100644 --- a/src/executor_asio.cpp +++ b/src/executor_asio.cpp @@ -622,6 +622,8 @@ struct watcher_impl { : ctx{strand.ref->ctx}, strand_{strand.ref->strand_}, fd_{*ctx->asio, fd} {} + ~watcher_impl() { fd_.release(); } + void wait_read(watcher::handler h) { if (!read_in_progress_) { read_in_progress_ = true; From a7b2354ad2fbe9d2b3629a455f2e823b463c18eb Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 30 Apr 2025 14:48:35 +0200 Subject: [PATCH 2/2] fix: remove descriptor error log messages --- src/thespian.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thespian.zig b/src/thespian.zig index 136937d..5a5c80f 100644 --- a/src/thespian.zig +++ b/src/thespian.zig @@ -756,7 +756,7 @@ pub const file_descriptor = struct { const Self = @This(); pub fn init(tag_: []const u8, fd: i32) !Self { - return .{ .handle = c.thespian_file_descriptor_create(tag_.ptr, fd) orelse return log_last_error(error.ThespianFileDescriptorInitFailed) }; + return .{ .handle = c.thespian_file_descriptor_create(tag_.ptr, fd) orelse return error.ThespianFileDescriptorInitFailed }; } pub fn wait_write(self: *const Self) !void {