diff options
Diffstat (limited to 'src/tui')
| -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)); } } |
