diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-21 07:50:25 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-21 08:14:14 -0300 |
| commit | 5ad6067936f306271b875aaf182d4866055da10d (patch) | |
| tree | 10790712fb4cd8110c2ad7c8a9ae53e452019323 /runtime | |
| parent | bbae7225e939daf4b6360d3de7af06c0fd95ce8d (diff) | |
| download | pardes-5ad6067936f306271b875aaf182d4866055da10d.tar.gz pardes-5ad6067936f306271b875aaf182d4866055da10d.zip | |
client: an Upgrade from the installed build (main 6d937cd125ca) to this one, the coordinator's release stage: a window exec'd at an Upgrade takes its size from PARDES_JOIN_SIZE (runtime/client.zig `execAgain`; dev/gui/gui.zig where `--geometry` is read), a string a test finds in the binary as PARDES_JOIN_VIEW is: test/daemon.py `knows_size`, and `pair_window_geometry` skips with a line said when the old window cannot pass its size (the installed build's: by design, its exec is the old client's); a far link cut with no last word dials again too (`replica.cutListed(why, session, far)`: the dial is the asking, the far daemon's "no session called" ends it), as near ones do since item 0: from the installed build `far_exec` lost its client before (2 of 6 runs) and still does once in five (the old far client is the installed build's code); a far client whose ssh link drops now dials again for up to 20 s before it says so
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/client.zig | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/runtime/client.zig b/runtime/client.zig index 789cac27..49ebbc6e 100644 --- a/runtime/client.zig +++ b/runtime/client.zig @@ -129,24 +129,29 @@ pub fn execAgain(s: *Start, view: u8, size: ?[2]c_int) []const u8 { const path = upgrade.exe() orelse return "Upgrade: this client does not know the path it was started from"; var at_buf: [4200]u8 = undefined; const at = std.fmt.bufPrintSentinel(&at_buf, "--attach={s}:{s}", .{ s.dial.path, s.dial.session }, 0) catch return "Upgrade: the session's socket's path is too long to attach again by"; - // A window's new window the size it had (`--geometry`), not the default. + const argv = [_:null]?[*:0]const u8{ path, at }; + // A window's new window the size it had (gui.zig reads it as a + // `--geometry`), not the default. var size_buf: [48]u8 = undefined; - const geometry: ?[*:0]const u8 = if (size) |wh| (std.fmt.bufPrintSentinel(&size_buf, "--geometry={d}x{d}", .{ wh[0], wh[1] }, 0) catch unreachable).ptr else null; // two c_ints fit 48 - const argv = [_:null]?[*:0]const u8{ path, at, geometry }; + const sized: ?[*:0]const u8 = if (size) |wh| (std.fmt.bufPrintSentinel(&size_buf, "PARDES_JOIN_SIZE={d}x{d}", .{ wh[0], wh[1] }, 0) catch unreachable).ptr else null; // two c_ints fit 48 var view_buf: [32]u8 = undefined; const joining = std.fmt.bufPrintSentinel(&view_buf, "PARDES_JOIN_VIEW={d}", .{view}, 0) catch unreachable; // a u8 fits 32 var n: usize = 0; while (libc.environ[n] != null) n += 1; - const envp = s.gpa.allocSentinel(?[*:0]const u8, n + 2, null) catch return "Upgrade: no memory for this client's environment"; + const envp = s.gpa.allocSentinel(?[*:0]const u8, n + 3, null) catch return "Upgrade: no memory for this client's environment"; var k: usize = 0; for (libc.environ[0..n]) |e| { const entry = std.mem.span(e.?); - if (std.mem.startsWith(u8, entry, "PARDES_JOIN_VIEW=") or std.mem.startsWith(u8, entry, "PARDES_REPLICA_FAR=")) continue; + if (std.mem.startsWith(u8, entry, "PARDES_JOIN_VIEW=") or std.mem.startsWith(u8, entry, "PARDES_JOIN_SIZE=") or std.mem.startsWith(u8, entry, "PARDES_REPLICA_FAR=")) continue; envp[k] = e; k += 1; } envp[k] = joining.ptr; k += 1; + if (sized) |e| { + envp[k] = e; + k += 1; + } if (s.have != null) { envp[k] = "PARDES_REPLICA_FAR=1"; k += 1; @@ -220,7 +225,7 @@ pub fn Loop(comptime Frontend: type) type { s.joined.rest.deinit(s.gpa); // Its link cut with no word by a session that is there still // (an Upgrade's exec): joined again, as when told so. - if (link.gone and link.refused == null and link.ended == null and !link.left and s.have == null and replica.cutListed("the session hung up", s.dial.session)) + if (link.gone and link.refused == null and link.ended == null and !link.left and replica.cutListed("the session hung up", s.dial.session, s.have != null)) link.refused = std.heap.c_allocator.dupe(u8, replica.upgrading) catch null; // Why it joins again is in its notice until a key. if (!link.rejoins()) { |
