diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:04:43 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 09:54:56 -0300 |
| commit | 236c9f51134adf04932f7653ed0262a0c9253708 (patch) | |
| tree | 6fc3a8c3aae7b571a6a7cfbe2a80f8b6bbbebfb8 /src/tui/tui.zig | |
| parent | 2e81cbc86e51864debd5f02a0d03a35b35cb6f64 (diff) | |
| download | pardes-236c9f51134adf04932f7653ed0262a0c9253708.tar.gz pardes-236c9f51134adf04932f7653ed0262a0c9253708.zip | |
replica: a client's join, the terminal's and the window's alike, is replica.join (the session dialled, its build checked, its dump loaded and checked, or joined again for its view once its link ends, the core it leaves held meanwhile), where tui.zig and gui.zig each spelled out the dial, the check, the load, the redial and their timing; Link.reset takes the join, and Link.load, Link.joinedAs and Link.redial go
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/tui/tui.zig')
| -rw-r--r-- | src/tui/tui.zig | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/src/tui/tui.zig b/src/tui/tui.zig index 2a107dc4..ff0e8334 100644 --- a/src/tui/tui.zig +++ b/src/tui/tui.zig @@ -17,7 +17,6 @@ const daemon = @import("../daemon.zig"); const host_io = @import("../host_io.zig"); const upgrade = @import("../upgrade.zig"); const replica = @import("../replica.zig"); -const wire = @import("../detached/wire.zig"); extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int; @@ -1235,10 +1234,6 @@ pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, se var have_store: replica.Have = if (far) .init(io) else .{ .io = io }; defer have_store.deinit(); const have: ?*replica.Have = if (far) &have_store else null; - var dial_t0 = std.Io.Clock.awake.now(io).nanoseconds; - var joined = replica.dial(gpa, path, session, &why, have, null) orelse Said.no(io, "{s}", .{std.mem.sliceTo(&why, 0)}); - if (joined.semantics != wire.semantics) Said.no(io, "{s}", .{replica.Link.upgrade_words}); - const allocs = pardes.memory.init(gpa); defer pardes.memory.deinit(); pardes.image.start(io, allocs.image); @@ -1252,9 +1247,8 @@ pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, se var o = opts; o.image_allocator = allocs.image; o.pdf_allocator = allocs.pdf; - var r = replica.Link.load(gpa, &joined, o, &why, have) orelse Said.no(io, "{s}", .{std.mem.sliceTo(&why, 0)}); - // Its join's time, the dial and the load (PARDES_REPLICA_STATS). - var dial_ms: u64 = @intCast(@divTrunc(std.Io.Clock.awake.now(io).nanoseconds - dial_t0, std.time.ns_per_ms)); + var joined: replica.Joined = undefined; + var r = replica.join(gpa, &joined, path, session, o, have, &why, null) orelse Said.no(io, "{s}", .{std.mem.sliceTo(&why, 0)}); var winch_set = posix.sigemptyset(); posix.sigaddset(&winch_set, posix.SIG.WINCH); @@ -1302,14 +1296,12 @@ pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, se // A join a pass: the first, and one after the replica diverged or the // session let it go to upgrade. The terminal stays as it is. while (true) { - r.gmtoff = joined.gmtoff; sh.core = r.core(); sh.from = joined.view; sh.terms = @splat(null); sh.terms[joined.view] = &screen; screen.feed.view = joined.view; - link.reset(r, joined.fd); - link.joinedAs(&joined, dial_ms); + link.reset(r, &joined); var reader_done: std.atomic.Value(bool) = .init(false); const reader = try std.Thread.spawn(.{}, linkReader, .{ gpa, joined.fd, &joined.rest, &loop, &reader_done }); // What it is, then its size, are its view's first inputs. @@ -1383,19 +1375,10 @@ pub fn remote(init: std.process.Init, opts: pardes.Options, path: []const u8, se } // The session again, the core it leaves held meanwhile: its blobs // are not sent again. - if (have) |h| h.leaving(r.core()); - dial_t0 = std.Io.Clock.awake.now(io).nanoseconds; - joined = replica.Link.redial(gpa, path, session, &why, have, r.diverged == null, joined.view) orelse { - screen.leave(); - Said.no(io, "could not join again: {s}", .{std.mem.sliceTo(&why, 0)}); - }; - if (have) |h| h.left(); - r.deinit(); - r = replica.Link.load(gpa, &joined, o, &why, have) orelse { + r = replica.join(gpa, &joined, path, session, o, have, &why, r) orelse { screen.leave(); Said.no(io, "{s}", .{std.mem.sliceTo(&why, 0)}); }; - dial_ms = @intCast(@divTrunc(std.Io.Clock.awake.now(io).nanoseconds - dial_t0, std.time.ns_per_ms)); } } |
