diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 09:36:22 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 11:35:33 -0300 |
| commit | efbb9bb38b800deb47e581fd7b0a7ea06d504122 (patch) | |
| tree | c06a0b742b1ce6b788b9baeddc7b6f008d4604ce /runtime | |
| parent | 6ba1f5be0a838d1fda81425300ed5aca90b1f1ab (diff) | |
| download | pardes-efbb9bb38b800deb47e581fd7b0a7ea06d504122.tar.gz pardes-efbb9bb38b800deb47e581fd7b0a7ea06d504122.zip | |
attachClient: a far attach dials the forwarded socket until a connect answers, within the same 30 s, not only until its file is there: ssh binds the socket (its file) a moment before it listens, and a client that dialled between the two was told 'nothing answers at .../pardes-ssh-N.sock' (4 of 40 attaches through test/daemon.py's stand-in ssh at a load of 38-45; 10 of 10 with 0.5 s between its bind and listen); the probe is cloud9's connectFd, closed at once, then the client dials as before: 0 of 40 and 0 of 20 refused-name attaches with the 0.5 s; test/delay_relay.py --bound MS holds a socket bound that long before listening, and daemon.py --far's ssh uses 500; after, pinned to one CPU: 0 of 40, and 0 of 20 with the 0.5 s; the five together: tui core-test 859/1014, shell-test 1055/1058, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay, process-test 0 of 144 (cmdexit once, again alone), daemon.py in every mode, both soaks diverged 0 unequal 0, gui unit-test 1651/1655 (BaselineHarnessMismatch), the frame and perf gate against tree2 PASS
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/main.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/main.zig b/runtime/main.zig index 29c19bc0..be2aa54b 100644 --- a/runtime/main.zig +++ b/runtime/main.zig @@ -1842,8 +1842,11 @@ fn attachClient(init: std.process.Init, opts: pardes.Options, where: []const u8, Ssh.child = pid; Ssh.path = here; _ = atexit(Ssh.end); + // Its file is there a moment before ssh listens on it: until a + // connect answers. var waited: u32 = 0; - while (std.meta.isError(std.Io.Dir.cwd().access(io, here, .{}))) : (waited += 1) { + const probe = while (true) : (waited += 1) { + if (cloud9.transport.connectFd(.{ .unix = here }, cloud9.transport.nowMs() + 100)) |fd| break fd else |_| {} var status: c_int = 0; if (std.c.waitpid(pid, &status, std.c.W.NOHANG) == pid) { Ssh.child = 0; @@ -1852,7 +1855,8 @@ fn attachClient(init: std.process.Init, opts: pardes.Options, where: []const u8, if (waited > 3000) die(io, "--attach: ssh to {s} set up no forward in 30 s", .{where}); const ts: std.c.timespec = .{ .sec = 0, .nsec = 10 * std.time.ns_per_ms }; _ = std.c.nanosleep(&ts, null); - } + }; + _ = std.c.close(probe); clientOf(init, opts, here, name, true) catch |err| die(io, "--attach: {t}", .{err}); std.process.exit(0); } |
