summaryrefslogtreecommitdiff
path: root/core/replica.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 07:50:25 -0300
committerGabriel Schneider <[email protected]>2026-11-21 08:14:14 -0300
commit5ad6067936f306271b875aaf182d4866055da10d (patch)
tree10790712fb4cd8110c2ad7c8a9ae53e452019323 /core/replica.zig
parentbbae7225e939daf4b6360d3de7af06c0fd95ce8d (diff)
downloadpardes-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 'core/replica.zig')
-rw-r--r--core/replica.zig17
1 files changed, 10 insertions, 7 deletions
diff --git a/core/replica.zig b/core/replica.zig
index edab01ee..97da9c74 100644
--- a/core/replica.zig
+++ b/core/replica.zig
@@ -3112,13 +3112,16 @@ pub fn ended(why: []const u8) bool {
/// What an Upgrade tells its clients (`Peers.refuseAll`): each dials again.
pub const upgrading = "the session is upgrading to another build of pardes";
-/// A near link cut with no last word (`why` its hang-up) whose session this
-/// machine's daemon lists still: an Upgrade's exec cut it, a dump on the
-/// way past the clients' flush (`Peers.refuseAll`), not the session's end,
-/// which the daemon sees as its link's: so the client joins again as one
-/// told `upgrading` does, whatever the flush's bound let through.
-pub fn cutListed(why: []const u8, session: []const u8) bool {
+/// A link cut with no last word (`why` its hang-up) whose session its
+/// daemon lists still: an Upgrade's exec cut it, a dump on the way past the
+/// clients' flush (`Peers.refuseAll`), whichever build the session is, not
+/// the session's end, which the daemon sees as its link's: so the client
+/// joins again as one told `upgrading` does, whatever the flush's bound let
+/// through. Near, this machine's daemon is asked; far, the dial again is
+/// the asking (the far daemon's "no session called" ends it: `redial`).
+pub fn cutListed(why: []const u8, session: []const u8, far: bool) bool {
if (!std.mem.startsWith(u8, std.mem.sliceTo(why, 0), "the session hung up")) return false;
+ if (far) return true;
var buf: [8192]u8 = undefined;
const list = daemon.ask("list", &buf) orelse return false;
var lines = std.mem.tokenizeScalar(u8, list, '\n');
@@ -3170,7 +3173,7 @@ pub fn join(gpa: Allocator, j: *Joined, path: []const u8, session: []const u8, o
sameBuild(gpa, (dial(gpa, path, session, why, have, null) orelse
// Handed to the session as it upgraded, or cut by its exec with
// its dump on the way: it is there again soon.
- if (std.mem.eql(u8, std.mem.sliceTo(why, 0), upgrading) or (have == null and cutListed(why, session))) redial(gpa, path, session, why, have, true, null) else null) orelse return null, why)) orelse return null;
+ if (std.mem.eql(u8, std.mem.sliceTo(why, 0), upgrading) or cutListed(why, session, have != null)) redial(gpa, path, session, why, have, true, null) else null) orelse return null, why)) orelse return null;
defer {
if (have) |h| h.store(gpa, j) else gpa.free(j.dump);
j.dump = &.{};