summaryrefslogtreecommitdiff
path: root/src/Server.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Server.zig')
-rw-r--r--src/Server.zig7
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 {