diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 07:27:13 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | 22fb8b6147f7fb72407af80c36d5e99e4664fea2 (patch) | |
| tree | 0f5543812af5421a55d21e3bd95d929a19b48d82 /src/builtins.zig | |
| parent | b3557640d6a0a4c2c41b6e1cae3c8182a32937ca (diff) | |
| download | pardes-22fb8b6147f7fb72407af80c36d5e99e4664fea2.tar.gz pardes-22fb8b6147f7fb72407af80c36d5e99e4664fea2.zip | |
Mount dials its peer at once and fails if none answers; a peer out of reach is said as `dial failed: <reason>`
Mount took any well-formed dial and nothing was found out until the
first look through it, which then said `look: look: dial`. Mount now
probes the peer (version, attach, its root) with the turn out, and fails
its write, mounting nothing, when none answers; the dial errors read as
words, `no answer`, `timed out`, `hung up`, and a look through a peer
gone since names its path: `look: /n/peer/f: dial failed: no answer`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 404e78f4..3f4a680c 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -676,6 +676,21 @@ pub const Mount = struct { const dial = std.mem.trim(u8, args.rest(), " \t"); if (dial.len == 0) return c.p.reportError(c.id, "Mount name dial", error.MissingArgument); c.p.fs.mount(c.p.gpa, name, dial) catch |err| return c.p.reportError(c.id, "Mount", err); + // A mount that cannot be reached is said now, and taken back, not + // found out by the first look through it. + const reached = reached: { + pardes.turn.yield(); + defer pardes.turn.back(); + break :reached @import("9p_io.zig").Client.probe(c.p.gpa, dial); + }; + reached catch |err| { + if (c.p.fs.mounts.pop()) |gone| { + c.p.gpa.free(gone.name); + c.p.gpa.free(gone.dial); + } + var what: [160]u8 = undefined; + return c.p.reportError(c.id, std.fmt.bufPrint(&what, "Mount {s} {s}", .{ name, dial[0..@min(dial.len, 100)] }) catch "Mount", err); + }; } }; |
