From d8488fde4902565f4ac8519565f234918dab6b11 Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Thu, 8 Jan 2026 11:48:12 -0500 Subject: support hpub fixed issue where not all data was being sent request reply has a performance issue but technically works --- src/Server/Client.zig | 68 --------------------------------------------------- 1 file changed, 68 deletions(-) (limited to 'src/Server/Client.zig') diff --git a/src/Server/Client.zig b/src/Server/Client.zig index a7dd007..26be79f 100644 --- a/src/Server/Client.zig +++ b/src/Server/Client.zig @@ -6,11 +6,6 @@ const Queue = std.Io.Queue; const Client = @This(); -pub const Msgs = union(enum) { - MSG: Message.Msg, - HMSG: Message.HMsg, -}; - connect: ?Message.Connect, // Byte queue for this client to receive. recv_queue: *Queue(u8), @@ -48,69 +43,6 @@ pub fn start(self: *Client, io: std.Io) !void { self.to_client.end = try self.recv_queue.get(io, self.to_client.buffer, 1); try self.to_client.flush(); } - // while (true) { - // switch (try io.select(.{ .msgs = &recv_msgs_task, .proto = &recv_proto_task })) { - // .msgs => |len_err| { - // @branchHint(.likely); - // const msgs = msgs_buf[0..try len_err]; - // for (0..msgs.len) |i| { - // const msg = msgs[i]; - // defer switch (msg) { - // .MSG => |m| m.deinit(self.alloc), - // .HMSG => |h| h.deinit(self.alloc), - // }; - // errdefer for (msgs[i + 1 ..]) |mg| switch (mg) { - // .MSG => |m| { - // m.deinit(self.alloc); - // }, - // .HMSG => |h| { - // h.deinit(self.alloc); - // }, - // }; - // switch (msg) { - // .MSG => |m| { - - // }, - // .HMSG => |hmsg| { - // try self.to_client.print("HMSG {s} {s} {s} {d} {d}\r\n", .{ - // hmsg.msg.subject, - // hmsg.msg.sid, - // hmsg.msg.reply_to orelse "", - // hmsg.header_bytes, - // hmsg.msg.payload.len, - // }); - // try hmsg.msg.payload.write(self.to_client); - // try self.to_client.print("\r\n", .{}); - // }, - // } - // } - // recv_msgs_task = io.concurrent(Queue(Msgs).get, .{ self.msg_queue, io, &msgs_buf, 1 }) catch unreachable; - // }, - // .proto => |msg_err| { - // @branchHint(.unlikely); - // const msg = try msg_err; - // switch (msg) { - // .@"+OK" => { - // _ = try self.to_client.write("+OK\r\n"); - // }, - // .PONG => { - // _ = try self.to_client.write("PONG\r\n"); - // }, - // .INFO => |info| { - - // }, - // .@"-ERR" => |s| { - // _ = try self.to_client.print("-ERR '{s}'\r\n", .{s}); - // }, - // else => |m| { - // std.debug.panic("unimplemented write: {any}\n", .{m}); - // }, - // } - // recv_proto_task = io.concurrent(Queue(Message).getOne, .{ self.recv_queue, io }) catch unreachable; - // }, - // } - // try self.to_client.flush(); - // } } pub fn send(self: *Client, io: std.Io, msg: []const u8) !void { -- cgit