mirror of
https://git.robbyzambito.me/zits
synced 2026-02-04 03:34:48 +00:00
Cleanup Server.zig
This commit is contained in:
@@ -24,7 +24,7 @@ const Server = @This();
|
|||||||
|
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
pub const Subscription = struct {
|
const Subscription = struct {
|
||||||
subject: []const u8,
|
subject: []const u8,
|
||||||
client_id: usize,
|
client_id: usize,
|
||||||
sid: []const u8,
|
sid: []const u8,
|
||||||
@@ -384,9 +384,10 @@ fn unsubscribe(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const parseUnsigned = std.fmt.parseUnsigned;
|
/// Probes the system for an appropriate buffer size.
|
||||||
|
/// Try to match the kernel socket buffers to maximize
|
||||||
fn getBufferSizes(io: Io) struct { usize, usize } {
|
/// the amount of data we push through each syscall.
|
||||||
|
fn getBufferSizes(io: Io) @Tuple(&.{ usize, usize }) {
|
||||||
const default_size = 4 * 1024;
|
const default_size = 4 * 1024;
|
||||||
const default = .{ default_size, default_size };
|
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 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 });
|
log.err("couldn't parse {s}: {any}", .{ bytes[0 .. bytes.len - 1], err });
|
||||||
return default;
|
return default;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user