summaryrefslogtreecommitdiff
path: root/src/detached
diff options
context:
space:
mode:
Diffstat (limited to 'src/detached')
-rw-r--r--src/detached/server.zig14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/detached/server.zig b/src/detached/server.zig
index 3e98fc9d..6959e577 100644
--- a/src/detached/server.zig
+++ b/src/detached/server.zig
@@ -536,7 +536,7 @@ pub const Session = struct {
fn writeDump(ctx: ?*anyopaque, bytes: []const u8) void {
const s = of(ctx);
var pbuf: [1024:0]u8 = undefined;
- const path = pardes.dump.outPath(&pbuf) orelse return;
+ const path = pardes.dump.outPath(&pbuf, s.core.settings.dump_dir.get()) orelse return;
filesystem.write(s.core, path, bytes) catch |err| return s.core.reportError(0, "dump", err);
s.core.setLastDump(path);
}
@@ -809,8 +809,11 @@ pub const Session = struct {
// The wait is the 9P connections' turn with the core.
if (n == 0) {
pardes.turn.rest();
- defer pardes.turn.wake();
- return nap(if (timeout_ms == 0) 16 else timeout_ms);
+ nap(if (timeout_ms == 0) 16 else timeout_ms);
+ pardes.turn.wake();
+ // An animating frame's wait is the frame: tick it.
+ if (timeout_ms != 0) s.core.update(.tick);
+ return;
}
var timeout: c_int = if (timeout_ms == 0) -1 else @intCast(@min(timeout_ms, std.math.maxInt(c_int)));
if (s.nextWake(now)) |due| timeout = if (timeout < 0) due else @min(timeout, due);
@@ -819,6 +822,9 @@ pub const Session = struct {
const ready = libc.poll(&fds, @intCast(n), timeout);
pardes.turn.wake();
if (ready > 0) s.dispatch(fds[0..n], src[0..n]);
+ // Animating, the frame's time is up: advance it. There is no other
+ // tick in a detached session, and without it an animation never ends.
+ if (timeout_ms != 0 and monotonicMs() -| now >= timeout_ms) s.core.update(.tick);
_ = s.drainCompletions(true);
s.expire(monotonicMs());
s.harvest();
@@ -1156,7 +1162,7 @@ pub fn run(init: std.process.Init, opts: pardes.Options, name: []const u8) !void
try session.core.pump(h);
if (session.core.quit) break;
if (session.core.takeRestore()) |path| restore: {
- const bytes = filesystem.readRestore(gpa, path) catch |err| {
+ const bytes = filesystem.readRestore(gpa, path, session.core.settings.dump_dir.get()) catch |err| {
session.core.reportError(session.core.active, "Restore", err);
break :restore;
};