mirror of
https://git.robbyzambito.me/zits
synced 2026-02-04 11:44:48 +00:00
sending errors on pub sub!
This commit is contained in:
@@ -63,6 +63,8 @@ fn handleConnection(
|
||||
var writer = stream.writer(io, &w_buffer);
|
||||
const out = &writer.interface;
|
||||
|
||||
std.debug.print("out pointer in client handler: {*}\n", .{out});
|
||||
|
||||
var r_buffer: [8192]u8 = undefined;
|
||||
var reader = stream.reader(io, &r_buffer);
|
||||
const in = &reader.interface;
|
||||
@@ -71,8 +73,8 @@ fn handleConnection(
|
||||
var connect_arena: std.heap.ArenaAllocator = .init(allocator);
|
||||
defer connect_arena.deinit();
|
||||
const connect = (Message.next(connect_arena.allocator(), in) catch return).connect;
|
||||
var client_state: ClientState = try .init(io, id, connect, in, out);
|
||||
defer client_state.deinit(io);
|
||||
var client_state: ClientState = try .init(io, allocator, id, connect, in, out);
|
||||
defer client_state.deinit(io, allocator);
|
||||
|
||||
try server.addClient(allocator, id, &client_state);
|
||||
defer server.removeClient(allocator, id);
|
||||
@@ -107,7 +109,9 @@ fn handleConnection(
|
||||
switch (msg) {
|
||||
.ping => {
|
||||
std.debug.print("got a ping! sending a pong.\n", .{});
|
||||
@import("./client.zig").writePong(out) catch return;
|
||||
|
||||
std.debug.print("recv queue in server loop: {*}\n", .{&client_state.recv_queue});
|
||||
// @import("./client.zig").writePong(out) catch return;
|
||||
for (0..5) |_| {
|
||||
if (try client_state.send(io, .pong)) {
|
||||
std.debug.print("sent pong\n", .{});
|
||||
|
||||
Reference in New Issue
Block a user