summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2026-01-06 22:26:49 -0500
committerRobby Zambito <contact@robbyzambito.me>2026-01-06 22:27:13 -0500
commit3b490fc3c8864eec0c3f4e92a2a2014711ff09c8 (patch)
treed1cb092ad727671d2ea8c985faa85833ad5cd049
parent48969283527e0db6b71893b2b3f3bbeb21e522db (diff)
Cleanup Server.zig
-rw-r--r--src/Server.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Server.zig b/src/Server.zig
index c2cc17d..7e30b76 100644
--- a/src/Server.zig
+++ b/src/Server.zig
@@ -24,7 +24,7 @@ const Server = @This();
const builtin = @import("builtin");
-pub const Subscription = struct {
+const Subscription = struct {
subject: []const u8,
client_id: usize,
sid: []const u8,
@@ -384,9 +384,10 @@ fn unsubscribe(
}
}
-const parseUnsigned = std.fmt.parseUnsigned;
-
-fn getBufferSizes(io: Io) struct { usize, usize } {
+/// Probes the system for an appropriate buffer size.
+/// 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 = .{ default_size, default_size };
@@ -409,7 +410,7 @@ fn readBufferSize(io: Io, dir: anytype, filename: []const u8, buf: []u8, default
return default;
};
- return parseUnsigned(usize, bytes[0 .. bytes.len - 1], 10) catch |err| {
+ return std.fmt.parseUnsigned(usize, bytes[0 .. bytes.len - 1], 10) catch |err| {
log.err("couldn't parse {s}: {any}", .{ bytes[0 .. bytes.len - 1], err });
return default;
};