summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-30 10:21:51 -0300
committerGabriel Schneider <[email protected]>2026-10-30 12:47:01 -0300
commit7753126756dd6a8dc371fa200e6ba84b3c0eb6f2 (patch)
tree89c89b46fbca960b60cbcc9c709d51f79c03556c /src
parent544d41b77eea27447b329a06f0fa2b852479674c (diff)
downloadpardes-7753126756dd6a8dc371fa200e6ba84b3c0eb6f2.tar.gz
pardes-7753126756dd6a8dc371fa200e6ba84b3c0eb6f2.zip
remote client: a write to the session that fails is its hangup (a client cut off as it lags said nothing and exited 0 when its own write found the link shut before its reader did); a window client's frame is marked rendered as it presents, so the live harness reads its render as its core's time; test/daemon.py's window clients: one far (PARDES_REPLICA_FAR) put off the session's state rejoins from the core it left, and again across an Upgrade (its `refused`); a client's echo stats in PARDES_REPLICA_STATS; --ps beside them lists the session alone, a window's as (gui, attached), its clients none
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui.zig5
-rw-r--r--src/replica.zig16
2 files changed, 15 insertions, 6 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index f62871c4..ff1c7793 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -2669,8 +2669,9 @@ const Client = struct {
const needs = core.needs_frame;
core.frames.mark_start = pardes.FrameStats.nowNs();
core.frames.mark_update = core.frames.mark_start;
- r.draw(.{ .ctx = s, .f = present });
+ // Its render's end is marked as it presents (`present`).
core.frames.mark_render = core.frames.mark_update;
+ r.draw(.{ .ctx = s, .f = present });
cl.link.owed = core.present_skipped;
core.frames.record(pardes.FrameStats.nowNs(), false, cl.link.owed);
core.present_skipped = skipped;
@@ -5194,6 +5195,8 @@ test "background opacity acknowledges success and rolls back unsupported surface
fn present(ctx: ?*anyopaque, surface: *const pardes.Surface) void {
const s = shellOf(ctx);
const core = s.core;
+ // A replica client draws outside the pump, which marks it there.
+ if (s.remote != null) core.frames.mark_render = pardes.FrameStats.nowNs();
s.follow();
const g = s.gui orelse return;
frame_started_ns = monoNs();
diff --git a/src/replica.zig b/src/replica.zig
index 32fd4fbe..02141f44 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -2646,7 +2646,7 @@ pub const Link = struct {
if (c.notice_len > 0 and (ev == .key or ev == .paste)) c.notice_len = 0;
c.input_ns = nowNs();
const msg = c.r.input(ev) catch return;
- if (!sendInput(c.fd, msg)) c.quit = true;
+ if (!sendInput(c.fd, msg)) c.cut();
c.dirty = true;
}
@@ -2667,9 +2667,7 @@ pub const Link = struct {
},
.screen => |bytes| {
defer std.heap.c_allocator.free(bytes);
- if (c.r.screen(bytes)) |reply| if (!sendScreen(c.fd, reply)) {
- c.quit = true;
- };
+ if (c.r.screen(bytes)) |reply| if (!sendScreen(c.fd, reply)) c.cut();
c.dirty = true;
},
.checked => |d| c.checked(d),
@@ -2693,11 +2691,18 @@ pub const Link = struct {
}
c.dirty = false;
while (c.r.screenRequest()) |req| if (!sendScreen(c.fd, req)) {
- c.quit = true;
+ c.cut();
break;
};
}
+ /// A write to the session failed: it hung up (it cut this client off,
+ /// lagging), as its reader will say.
+ fn cut(c: *Link) void {
+ c.quit = true;
+ c.gone = true;
+ }
+
/// Each pass of the frontend's loop: quiet (nothing of its own
/// pending) 300 ms after its last input and its last check, and
/// changed since, the session's digest is asked once, answered in
@@ -2711,6 +2716,7 @@ pub const Link = struct {
if (since < quiet_ns) return @intCast((quiet_ns - since) / std.time.ns_per_ms + 1);
c.changed = false;
c.asked = askCheck(c.fd);
+ if (!c.asked) c.cut();
c.asked_ns = nowNs();
return null;
}