diff options
Diffstat (limited to 'core/replica.zig')
| -rw-r--r-- | core/replica.zig | 10 |
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; |
