aboutsummaryrefslogtreecommitdiff
path: root/packet_reader
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-04-13 22:55:35 +0100
committerubq323 <ubq323@ubq323.website>2024-04-13 22:55:35 +0100
commit53e2a1d2e8a110b30dd47f0a47574625286e4ff5 (patch)
tree9d5d4e8ae43df66b04a2a06ef9b68461e6bc28ed /packet_reader
parent8d562c375e5b8c75dd5dd3a89fb55d4f26ef1934 (diff)
big refactor
Diffstat (limited to 'packet_reader')
-rw-r--r--packet_reader/packet_reader.ha5
1 files changed, 5 insertions, 0 deletions
diff --git a/packet_reader/packet_reader.ha b/packet_reader/packet_reader.ha
index 02ecdba..30911df 100644
--- a/packet_reader/packet_reader.ha
+++ b/packet_reader/packet_reader.ha
@@ -69,9 +69,12 @@ export fn next(pr: *packet_reader) (packet | done | error) = {
// and return the packet,
// or, ascertain there is no full packet, and return done
if (len(pr.good) < size(u32)) return done;
+ fmt::println("a")!;
const packet_len = endian::legetu32(pr.good[0..4]);
if (packet_len < 8) return "packet size field too small": error;
+ fmt::println("b")!;
if (len(pr.good) < packet_len) return done;
+ fmt::println("c")!;
const packet_bytes = pr.good[..packet_len];
pr.good = pr.good[packet_len..];
@@ -80,6 +83,7 @@ export fn next(pr: *packet_reader) (packet | done | error) = {
switch (ty) {
case packet_type::DRAW_OP =>
const op = drawing::deser_op(packet_bytes[8..]);
+ fmt::println("d")!;
return op: packet_drawop;
case packet_type::SEND_CHUNK =>
// return value is BORROWED from the BUFFER
@@ -91,6 +95,7 @@ export fn next(pr: *packet_reader) (packet | done | error) = {
): drawing::pos;
const d = cast_u8s_to_u32s(chunk_data_bytes);
assert(len(d) == 512*512,"wrong chunk size??");
+ fmt::println("e")!;
return packet_sendchunk { world_pos = pos, chunk_data = d };
};
};