mirror of
https://git.robbyzambito.me/zits
synced 2026-02-04 03:34:48 +00:00
parsing cleanup
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user