summaryrefslogtreecommitdiff
path: root/src/Client.zig
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2025-05-10 12:50:19 -0400
committerRobby Zambito <contact@robbyzambito.me>2025-05-10 21:46:53 -0400
commit583f9d8b8fb094c39636348a2b609aa7a2043f0f (patch)
treee24c383e6f57fa51b999e78510826bfd0c624f1b /src/Client.zig
parent56e72928c6e9ea554870d9673b71d280bfb50e09 (diff)
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.
Diffstat (limited to 'src/Client.zig')
-rw-r--r--src/Client.zig2
1 files changed, 1 insertions, 1 deletions
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());