summaryrefslogtreecommitdiff
path: root/runtime/session.zig
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/session.zig')
-rw-r--r--runtime/session.zig12
1 files changed, 10 insertions, 2 deletions
diff --git a/runtime/session.zig b/runtime/session.zig
index 5e99384e..9499da9c 100644
--- a/runtime/session.zig
+++ b/runtime/session.zig
@@ -86,7 +86,11 @@ pub fn Loop(comptime Frontend: type) type {
defer l.prompt_rcs.deinit();
l.fs = ninep_io.start(l.io, l.gpa, l.core);
defer if (l.fs) |f| f.deinit(l.gpa);
- l.peers = .{ .gpa = l.gpa, .io = l.io, .name = daemon.name() };
+ // Its clients' terminals by the pty's bytes (Peers.bytes), each
+ // client's emulator its own; PARDES_TERM_SCREEN (a working name,
+ // the way back until the screen state's road is deleted): as
+ // screen state. Its welcome tells each client which.
+ l.peers = .{ .gpa = l.gpa, .io = l.io, .name = daemon.name(), .bytes = std.c.getenv("PARDES_TERM_SCREEN") == null };
l.inbox = .{ .io = l.io, .gpa = l.gpa, .lsp_allocator = l.allocs.lsp };
defer l.inbox.deinit();
// A search's worker may be waiting on the queue for room.
@@ -111,7 +115,7 @@ pub fn Loop(comptime Frontend: type) type {
// A first client on the socket it was started with, before its
// first effects: it has every terminal from its first byte, and
// no reload (Core.openView).
- if (o.pair) |fd| l.peers.join(l.core, .{ .fd = fd });
+ if (o.pair) |fd| l.peers.join(l.core, .{ .fd = fd, .own = true });
l.effects();
// ...and its shells, once a fresh session's own has a directory
// to adopt them in.
@@ -192,8 +196,12 @@ pub fn Loop(comptime Frontend: type) type {
// go, and its one could not join it again (no socket finds it):
// refused, as its Upgrade is (tui.zig `upgradeNow`).
if (l.peers.count() > 0 and daemon.link < 0) return l.core.reportFailure(l.core.view().active, "Restore: no daemon keeps this session, so its client could not join it again; this session stays as it is");
+ const watched = l.peers.count() > 0;
const nc = host_io.restoreCore(l.gpa, l.core, path, &l.peers, l.watches.fd, &l.watches.table) orelse return;
l.fe.restoring(nc);
+ // Its clients join again at once: the dump's messages are not
+ // put on the clock meanwhile (Messages.expireUnattended).
+ if (watched) nc.unattended = false;
// The old core's pipes end, and an answer to its query is
// turned away.
l.inbox.pipe_tasks.cancelAll(l.io);