mirror of
https://git.robbyzambito.me/zits
synced 2026-02-04 11:44:48 +00:00
Cleanup Server.zig
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user