aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2026-02-01 14:29:53 -0500
committerRobby Zambito <contact@robbyzambito.me>2026-02-01 19:16:22 -0500
commit558f40213b895810a78b2bbcbdbb95e88a301fde (patch)
tree6f164c0d109e7cfeff7db6a0a89f2baa2c8091f3 /src/main.zig
parentdaf18d35526870e39f3009b6bf9a64d0b4859b9f (diff)
Update to Saprus 0.2.1
Handle management messages instead of letting them bubble up through the connection to the consumer. Right now, this just means handling ping messages by sending a pong. Also updated to follow the new handshake flow. The sentinel will mirror the ports instead of matching them. Now filters on the full source and dest ports, which are less likely to have erroneous matches.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig
index 734357b..10dca33 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -191,6 +191,7 @@ pub fn main(init: std.process.Init) !void {
error.SymLinkLoop,
error.SystemResources,
=> blk: {
+ log.debug("Trying to execute command directly: {s}", .{connection_payload});
var argv_buf: [128][]const u8 = undefined;
var argv: ArrayList([]const u8) = .initBuffer(&argv_buf);
var payload_iter = std.mem.splitAny(u8, connection_payload, " \t\n");
@@ -229,7 +230,7 @@ pub fn main(init: std.process.Init) !void {
error.EndOfStream => {
cmd_output.print("{b64}", .{child_output_reader.interface.buffered()}) catch unreachable;
if (cmd_output.end > 0) {
- connection.send(init.io, cmd_output.buffered()) catch |e| {
+ connection.send(init.io, .{}, cmd_output.buffered()) catch |e| {
log.debug("Failed to send connection chunk: {t}", .{e});
continue :next_message;
};
@@ -238,7 +239,7 @@ pub fn main(init: std.process.Init) !void {
},
};
cmd_output.print("{b64}", .{try child_output_reader.interface.takeArray(child_output_buf.len)}) catch unreachable;
- connection.send(init.io, cmd_output.buffered()) catch |err| {
+ connection.send(init.io, .{}, cmd_output.buffered()) catch |err| {
log.debug("Failed to send connection chunk: {t}", .{err});
continue :next_message;
};