summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
};