From 09b77cf7c13c3384a53594e76f51161cab64e5dd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 17:47:51 -0300 Subject: serve: a client that finds every slot taken is told so, and the backend hears of it The runner closed an accepted connection without a word when its table was full, which a client cannot tell from a server that died. It now answers the Tversion with an Rerror "too many connections" under NOTAG, reads what the client already sent before closing (a TCP close over unread data resets), and calls the handler's new `refused`. The client takes an Rerror to its Tversion as that call's failure, with its words, instead of a broken protocol. Co-Authored-By: Claude Opus 5.5 --- src/client.zig | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/client.zig') diff --git a/src/client.zig b/src/client.zig index 307cd7f..2ae6df6 100644 --- a/src/client.zig +++ b/src/client.zig @@ -351,6 +351,12 @@ pub fn ClientWith(comptime tag_count: usize) type { fn consume(c: *@This(), got: Decoded) ?Done { if (isT(got.msg.msgType())) return c.die(); if (got.msg == .rversion) return c.version(got); + // A server may refuse the Tversion itself (all its slots taken): + // the call fails with its words, and nothing more is sent. + if (got.msg == .rerror and c.versioning and got.tag == notag) { + c.versioning = false; + return .{ .tag = notag, .op = .version, .result = .{ .fail = got.msg.rerror.ename } }; + } if (c.versioning or c.msize == 0) return c.die(); if (got.tag >= c.tags.len) return c.die(); const slot = &c.tags[got.tag]; -- cgit v1.3