diff options
| author | Robby Zambito <contact@robbyzambito.me> | 2026-01-09 15:43:40 -0500 |
|---|---|---|
| committer | Robby Zambito <contact@robbyzambito.me> | 2026-01-10 00:12:52 -0500 |
| commit | 0ebc39b5e872478e4d3059966ffc44a13231660e (patch) | |
| tree | ca5569cb52df85b0773362dbdf56921640072cf9 /src/Server.zig | |
| parent | f4b545f852fc52060f3b3fb55f69a8d7c52f8aa5 (diff) | |
parsing cleanup
Diffstat (limited to 'src/Server.zig')
| -rw-r--r-- | src/Server.zig | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Server.zig b/src/Server.zig index 68a7c49..d183593 100644 --- a/src/Server.zig +++ b/src/Server.zig @@ -195,7 +195,7 @@ fn handleConnection( // Respond to ping with pong. try client.recv_queue_write_lock.lock(io); defer client.recv_queue_write_lock.unlock(io); - _ = try client.from_client.take(2); + _ = try client.from_client.take(2); // throw out \r\n try client.recv_queue.putAll(io, "PONG\r\n"); }, .PUB => { @@ -355,13 +355,12 @@ fn publishMessage( }, else => {}, } - try line_writer.print("{d}\r\n", .{msg.payload.len}); + try line_writer.print("{d}\r\n", .{msg.payload.len - 2}); try subscription.queue_lock.lock(io); defer subscription.queue_lock.unlock(io); try subscription.queue.putAll(io, line_writer.buffered()); try subscription.queue.putAll(io, msg.payload); - try subscription.queue.putAll(io, "\r\n"); } } @@ -426,7 +425,7 @@ fn unsubscribe( /// Try to match the kernel socket buffers to maximize /// the amount of data we push through each syscall. fn getBufferSizes(io: Io) @Tuple(&.{ usize, usize }) { - const default_size = 4 * 1024; + const default_size = 8 * 1024 * 1024; const default = .{ default_size, default_size }; const dir = Dir.openDirAbsolute(io, "/proc/sys/net/core", .{}) catch { |
