diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 17:47:51 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-09-28 17:47:51 -0300 |
| commit | 09b77cf7c13c3384a53594e76f51161cab64e5dd (patch) | |
| tree | 061688947a11f48fb2219a46f16addeab9af1f9e /src/client.zig | |
| parent | 2a7137c644eb955d39ce3f07d75bf9c8fd9c932e (diff) | |
| download | cloud9-09b77cf7c13c3384a53594e76f51161cab64e5dd.tar.gz cloud9-09b77cf7c13c3384a53594e76f51161cab64e5dd.zip | |
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 <[email protected]>
Diffstat (limited to 'src/client.zig')
| -rw-r--r-- | src/client.zig | 6 |
1 files changed, 6 insertions, 0 deletions
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]; |
