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/ninep/ctl.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/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index b8f73c6f..7c68210a 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1712,6 +1712,22 @@ test "size sets the screen of a session no frontend is attached to, and only of try testing.expectEqual(@as(u16, 40), p.screen_h); } +test "Mount dials its peer and fails, mounting nothing, when none answers; a look through a peer gone says dial failed" { + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + const root_ctl = @intFromEnum(tree.TopFile.ctl); + const dead = "/tmp/pardes-test-no-such-peer.sock"; + const refused = wr(p, root_ctl, "Mount dead " ++ dead ++ "\n"); + try testing.expectEqual(E.IO, refused.errno()); + try testing.expectEqualStrings("Mount dead " ++ dead ++ ": dial failed: no answer \"Mount dead " ++ dead ++ "\"", refused.reply.ename); + try testing.expectEqual(@as(usize, 0), p.fs.mounts.items.len); + // Mounted when it answered, gone since: a look through it says so. + try p.fs.mounts.append(p.gpa, .{ .name = try p.gpa.dupe(u8, "gone"), .dial = try p.gpa.dupe(u8, dead) }); + const looked = wr(p, @intFromEnum(tree.TopFile.look), "/n/gone/f.txt\n"); + try testing.expect(looked.errno() != 0); + try testing.expect(th.logHas(p, "look: /n/gone/f.txt: dial failed: no answer")); +} + test "size is monotonic: growing is never refused, and a size once taken is taken again" { const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 60 }); defer p.deinit(); |
