From 22fb8b6147f7fb72407af80c36d5e99e4664fea2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 07:27:13 -0300 Subject: Mount dials its peer at once and fails if none answers; a peer out of reach is said as `dial failed: ` 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 --- src/Messages.zig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/Messages.zig') diff --git a/src/Messages.zig b/src/Messages.zig index c0838fb2..482ad64d 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -450,10 +450,27 @@ pub const no_pane_slots = "no space for a pane: {d} max"; pub const no_pane_room = "no space for a pane in that column: each keeps its tag and {d} rows"; /// `: `: FileNotFound reads "file not found". +/// Why a peer could not be reached, in words, for an error of a 9P dial +/// (src/9p_io.zig, Client); null for any other error. +pub fn dialReason(err: anyerror) ?[]const u8 { + return switch (err) { + error.Dial => "no answer", + error.Timeout => "timed out", + error.Hangup => "hung up", + error.Botch => "protocol botch", + else => null, + }; +} + pub fn reportError(p: *Pardes, id: usize, operation: []const u8, err: anyerror) void { var buf: [256]u8 = undefined; var w = std.Io.Writer.fixed(&buf); w.print("{s}: ", .{operation}) catch {}; + // A peer out of reach says so, not the error's name (`dial`). + if (dialReason(err)) |why| { + w.print("dial failed: {s}", .{why}) catch {}; + return reportFailure(p, id, w.buffered()); + } // Every route that opens a pane says the cap the same way. if (err == error.NoPaneSlots or err == error.NoPaneRoom) { if (err == error.NoPaneSlots) -- cgit v1.3