summaryrefslogtreecommitdiff
path: root/runtime/session.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 21:19:36 -0300
committerGabriel Schneider <[email protected]>2026-11-21 22:26:19 -0300
commit752cd81c1c5e1e91e1429cefc1c4651647981f88 (patch)
tree5c6ff207797f13deedbdc2d42b5ad1b2dd45a1f5 /runtime/session.zig
parent27874074025f88dd9e27ece82c352c4a7c35ab51 (diff)
downloadpardes-752cd81c1c5e1e91e1429cefc1c4651647981f88.tar.gz
pardes-752cd81c1c5e1e91e1429cefc1c4651647981f88.zip
pair: a pair's session puts the user's terminal back when its client dies with no word (P48): a tty pair (runtime/main.zig `pair`) keeps /dev/tty and its termios as they are before the client enters it and hands them to the session (dev/tui/tui.zig `Term.pair`, `Kept`); `Peers` marks the pair's first peer (`Peer.pair`, from `Joining.own`) and a bye (`Peer.bye`) and says at that peer's leave whether it left with no word at all (`Peers.pair_left`: no bye, not let go by the session, not cut); the session's frontend (`Own.sent`, now before a no-daemon pair's end in runtime/session.zig) writes on a loss what the own path writes when a terminal is lost under it (`Killed`'s bytes, which now also turn the in-band resize off: vaxis's terminal query turns it on) and the cooked termios, and lets the device go either way (a terminal held open keeps an ssh or its emulator waiting); not across an Upgrade (close-on-exec) nor after the pair's client joined again; daemon.py plain with the variable passes on Debug (it failed at 'the terminal is put back'), its row after a killed stub listing `(tty)` under the variable (a loss: still a pair's, P36), and --upgrade counts the device let go at the exec; core-test 896/1056, shell-test 1098/1101
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'runtime/session.zig')
-rw-r--r--runtime/session.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/session.zig b/runtime/session.zig
index 65432d97..890302b1 100644
--- a/runtime/session.zig
+++ b/runtime/session.zig
@@ -23,7 +23,8 @@
//! - `start(l)`: after the first effects, the ptys and the watches
//! read: its input, its readers, the listener's wake, a detached
//! session's first wait (`l.watch`).
-//! - `sent()`: after each step's unit went to the clients.
+//! - `sent()`: after each step's unit went to the clients (a pair's
+//! client gone with it: before its session ends).
//! - `upgradeAsked()`: an Upgrade asked in the step, done (it execs).
//! - `restoring(nc)`, `restored(l)`: a Restore's new core, before it
//! replaces the old one (its devices let go, what it is told of the
@@ -133,11 +134,12 @@ pub fn Loop(comptime Frontend: type) type {
try l.core.pump(l.host);
// Its unit to each replica client, and theirs taken in.
l.peers.boundary(l.core);
+ // Before a pair's end: its client's terminal put back (P48).
+ fe.sent();
// A pair's session with no daemon ends with its last link:
// nothing could attach to it again; with one, when its last
// client left with a close (not a loss) and it is not kept.
if (l.peers.count() == 0 and (l.peers.closed or (o.pair != null and daemon.link < 0))) break;
- fe.sent();
upgrade.locate();
// Asked in the step (the word), done between steps: the
// session whole.