summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/tree.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index 8902f11e..bd3f3b3b 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -1408,7 +1408,7 @@ fn writeNow(p: *Pardes, req: Req, target: Target) Reply {
fn writeRules(p: *Pardes, req: Req) Reply {
const done: Reply = .{ .tag = req.tag, .written = @intCast(req.data.len) };
// A close's rest (runClosedLines), or a write with no open: whole.
- const o = openOf(p, req) orelse return if (Plumb.apply(p, true, req.data)) |why| failText(req.tag, E.INVAL, why) else done;
+ const o = openOf(p, req) orelse return if (Plumb.apply(p, true, "plumb/rules", req.data)) |why| failText(req.tag, E.INVAL, why) else done;
if (o.pending.items.len + req.data.len > Plumb.max_text) {
o.pending.clearRetainingCapacity();
return failText(req.tag, E.INVAL, std.fmt.comptimePrint("rules too long; max {d} KiB", .{Plumb.max_text / 1024}));
@@ -1416,7 +1416,7 @@ fn writeRules(p: *Pardes, req: Req) Reply {
o.pending.appendSlice(p.gpa, req.data) catch return Reply.fail(req.tag, E.NOMEM);
const end = Plumb.wholeSets(o.pending.items);
if (end == 0) return done;
- const why = Plumb.apply(p, true, o.pending.items[0..end]);
+ const why = Plumb.apply(p, true, "plumb/rules", o.pending.items[0..end]);
if (why != null) o.pending.clearRetainingCapacity() else {
const rest = o.pending.items.len - end;
std.mem.copyForwards(u8, o.pending.items[0..rest], o.pending.items[end..]);
@@ -1449,7 +1449,10 @@ fn writeSend(p: *Pardes, req: Req) Reply {
},
.msg => |m| {
defer if (o) |op| op.pending.clearRetainingCapacity();
- if (Plumb.send(p, null, m)) |why| return failText(req.tag, E.IO, why);
+ switch (Plumb.send(p, null, m, null)) {
+ .refused => |why| return failText(req.tag, E.IO, why),
+ .done, .look => {},
+ }
return .{ .tag = req.tag, .written = @intCast(req.data.len) };
},
}