summaryrefslogtreecommitdiff
path: root/core/replica.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-20 18:08:49 -0300
committerGabriel Schneider <[email protected]>2026-11-20 18:08:49 -0300
commit4053e62a2aabd794db9075d93ebe57eec3f432a6 (patch)
treeb5a676e835b4df79f0670056a636410c97ffb8fd /core/replica.zig
parente3d0daa9f89f41b41b7d05d510db553cbd8816d9 (diff)
parent6683e03a40c0bbd88dadf6bb30121d41e944207c (diff)
downloadpardes-4053e62a2aabd794db9075d93ebe57eec3f432a6.tar.gz
pardes-4053e62a2aabd794db9075d93ebe57eec3f432a6.zip
integration: a hang-up is a close and a session can be kept, on the 9P state a join carries: pardes-pair-3 (a session's state as the daemon hears it: attached, detached, pair or kept, carried through an Upgrade; a terminal client takes HUP and TERM itself and leaves with a goodbye that closes; ps shows (tty) for a pair and (tty, kept); the documents say what PARDES_PAIR is) and pardes-merge40, merged without a textual conflict; tui core-test 871/1028 (157 skipped), shell-test 1070/1073, term-test 17/17, both soaks diverged 0, unequal 0, unlisted 0, the window builds; the coordinator's gate in the ledger (reorg/merge41)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/replica.zig')
-rw-r--r--core/replica.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/replica.zig b/core/replica.zig
index ff1e138e..1883e836 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -2059,10 +2059,10 @@ pub const Peers = struct {
/// No frontend of its own (the host says): with no client either, the
/// session is unattended.
detached: bool = false,
- /// Its last client left by closing its window, and no Detach was typed
- /// in any (`kept`): a pair's session ends there (runtime/session.zig).
+ /// Its last client left with a close (its window closed, its terminal
+ /// hung up) and the session is a pair's not kept (daemon.sessionState): it
+ /// ends there (runtime/session.zig).
closed: bool = false,
- kept: bool = false,
/// The worst a join cost the session's step, and the last one's dump.
join_ns: u64 = 0,
each_join: std.ArrayListUnmanaged(u64) = .empty,
@@ -2362,7 +2362,7 @@ pub const Peers = struct {
core.undrawn &= ~(@as(u8, 1) << @intCast(peer.view));
ps.closeViewOf(core, peer, peer.again);
if (ps.count() == 0) core.unattended = ps.detached;
- if (ps.count() == 0 and peer.close and !ps.kept) ps.closed = true;
+ if (ps.count() == 0 and peer.close and daemon.sessionState() == .pair) ps.closed = true;
ps.seq += 1;
ps.unit(0, ps.seq);
ps.letGo(peer);
@@ -2467,7 +2467,7 @@ pub const Peers = struct {
/// (`left`), its last word; the client goes, and its reader says so.
pub fn detach(ps: *Peers, k: u8) bool {
for (ps.list) |slot| if (slot) |peer| if (peer.view == k) {
- ps.kept = true;
+ daemon.keepSession();
var out: [wire.max_name + 8]u8 = undefined;
peer.last(wire.encodeServer(&out, .{ .left = ps.name[0..@min(ps.name.len, wire.max_name)] }) catch unreachable);
return true;