mirror of
https://git.robbyzambito.me/zaprus/
synced 2026-02-04 19:54:49 +00:00
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.
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user