diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 13:14:53 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-09-30 13:14:53 -0300 |
| commit | 4af5c9594a5e69a09d452d037d1c89ade5691475 (patch) | |
| tree | 133933edfe6e9dab10db79a842e65b2e6199aeee /src/fs.zig | |
| parent | f35b7ed09d0a170e4ffe55b5286c28f74c9a8760 (diff) | |
| download | cloud9-4af5c9594a5e69a09d452d037d1c89ade5691475.tar.gz cloud9-4af5c9594a5e69a09d452d037d1c89ade5691475.zip | |
fs: a request past the parking cap is refused "too many reads waiting: N", not EAGAIN's C string
The engine refused a read or write it had no slot to park with "Resource
temporarily unavailable", which reads as the C library's EAGAIN and says
nothing about why. The refusal now says so in words and names the cap
(opts.slot_capacity), so a client can tell it has too many reads held
on one connection. Refusals of what cannot park at all (a walk, a write
too long to copy) keep e_again.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/fs.zig')
| -rw-r--r-- | src/fs.zig | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -338,6 +338,10 @@ pub fn Server(comptime Backend: type, comptime opts: Options) type { return struct { const Self = @This(); + /// A request past the parking cap (`slot_capacity`) says so in + /// words, and names the cap, rather than a C library's EAGAIN. + pub const e_waiting = std.fmt.comptimePrint("too many reads waiting: {d}", .{opts.slot_capacity}); + protocol: Protocol, root: u64, @@ -1455,7 +1459,7 @@ pub fn Server(comptime Backend: type, comptime opts: Options) type { return; } const i = s.freeSlot() orelse { - s.fail(j.tag, e_again); + s.fail(j.tag, e_waiting); s.finishJob(); return; }; @@ -2264,7 +2268,8 @@ test "fs server: a blocked read parks, and the connection keeps working" { } try h.send(200, .{ .tread = .{ .fid = 1, .offset = 0, .count = 4096 } }); got = try h.reap(); - try testing.expectEqualStrings(e_again, got.msg.rerror.ename); + try testing.expectEqualStrings(Srv.e_waiting, got.msg.rerror.ename); + try testing.expect(std.mem.startsWith(u8, Srv.e_waiting, "too many reads waiting: ")); } test "fs server: a parked open, truncate and clunk complete on retry, and a walk cannot park" { |
