Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion zig/src/core/digest_key.zig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub const Key = struct {
}
const s = try file.stat(io);
if (s.kind != .file) return error.DigestNotRegular;
return .{ .device = 0, .inode = s.inode, .size = s.size, .mtime = s.mtime.toNanoseconds(), .ctime = s.ctime.toNanoseconds() };
return .{ .device = 0, .inode = @as(u64, @bitCast(s.inode)), .size = s.size, .mtime = s.mtime.toNanoseconds(), .ctime = s.ctime.toNanoseconds() };
}

pub fn equal(a: Key, b: Key) bool {
Expand Down
7 changes: 4 additions & 3 deletions zig/src/server/speech.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! POST /v1/audio/speech: WAV or raw PCM whole, or raw PCM chunks with stream; only complete synthesis is audio.
const std = @import("std");
const platform = @import("sys");
const api = @import("engine_api");
const json = @import("json");
const errors = @import("errors.zig");
Expand Down Expand Up @@ -276,10 +277,10 @@ fn startStream(c: *Conn, sample_rate: u32) error{Closed}!void {
if (c.close) c.addHeader("Connection", "close") catch return error.Closed;
// each chunk leaves at once rather than waiting on the client's acknowledgement of the last (no effect off TCP)
const one: c_int = 1;
_ = std.c.setsockopt(c.fd, std.posix.IPPROTO.TCP, std.posix.TCP.NODELAY, &one, @sizeOf(c_int));
if (platform.windows) platform.posix.setsockopt(c.fd, platform.posix.IPPROTO.TCP, platform.posix.TCP.NODELAY, std.mem.asBytes(&one)) catch {} else _ = std.c.setsockopt(c.fd, std.posix.IPPROTO.TCP, std.posix.TCP.NODELAY, &one, @sizeOf(c_int));
// a blocking write into a full socket returns after the stall limit, so writeAll's poll can end a stalled stream
const stall: std.posix.timeval = .{ .sec = @divTrunc(c.timeouts.write_ms, 1000), .usec = @rem(c.timeouts.write_ms, 1000) * 1000 };
std.posix.setsockopt(c.fd, std.posix.SOL.SOCKET, std.posix.SO.SNDTIMEO, std.mem.asBytes(&stall)) catch {};
const stall: platform.posix.timeval = .{ .sec = @divTrunc(c.timeouts.write_ms, 1000), .usec = @rem(c.timeouts.write_ms, 1000) * 1000 };
platform.posix.setsockopt(c.fd, platform.posix.SOL.SOCKET, platform.posix.SO.SNDTIMEO, std.mem.asBytes(&stall)) catch {};
return c.finish("");
}

Expand Down
Loading