From 583f9d8b8fb094c39636348a2b609aa7a2043f0f Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Sat, 10 May 2025 12:50:19 -0400 Subject: Add comments and fix tests Also added networkBytesAsValue and restored bytesAsValue. These are useful for treating the bytes from the network directly as a Message. Otherwise, the init function would overwrite the packet type and length to be correct. I would like the message handling to fail if the message body is incorrect. --- src/Client.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Client.zig') diff --git a/src/Client.zig b/src/Client.zig index 57af48c..f1786e8 100644 --- a/src/Client.zig +++ b/src/Client.zig @@ -127,7 +127,7 @@ pub fn connect(payload: []const u8, allocator: Allocator) !?SaprusConnection { const len = try sock.receive(&response_buf); std.debug.print("response bytes: {x}\n", .{response_buf[0..len]}); - initial_conn_res = SaprusMessage.init(.connection, response_buf[0..len]); + initial_conn_res = try .networkBytesAsValue(response_buf[0..len]); // Complete handshake after awaiting response try broadcastSaprusMessage(msg, randomPort()); -- cgit