diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 03:04:35 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 03:04:35 -0300 |
| commit | 422ad65025edd994b04728632fc96de4ebda07f7 (patch) | |
| tree | c07cb88dfe379ae7183bf1fd204724943fca3f5e /src/ninep | |
| parent | b7182d34e12130ced98dee7726b3bc87d4584ca9 (diff) | |
| download | pardes-422ad65025edd994b04728632fc96de4ebda07f7.tar.gz pardes-422ad65025edd994b04728632fc96de4ebda07f7.zip | |
A log follower hears every record queued before a Restore: the read it holds takes all that fit, before the hangup cuts it
A follower reads one record per read, and a Restore hangs every client
up, so records queued just before it -- the ones a script most wants,
what led up to the Restore -- were lost: the read after the first was
cut. Before the cut, each held read of /log is answered with every
whole record queued that fits it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/events.zig | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ninep/events.zig b/src/ninep/events.zig index 8fae6eab..d60c07ad 100644 --- a/src/ninep/events.zig +++ b/src/ninep/events.zig @@ -492,7 +492,18 @@ pub fn readLog(p: *Pardes, req: Req) Reply { slot.next += 1; slot.part = 0; } - return .{ .tag = req.tag, .payload = .{ .staged = @intCast(n) } }; + // This is the last read a Restore lets through: it takes every + // whole record that fits, or they were lost with the hangup. + if (p.fs.hanging_up and slot.part == 0) { + at += 4 + len; + while (at + 4 <= q.buf.items.len) : (slot.next += 1) { + const more = std.mem.readInt(u32, q.buf.items[at..][0..4], .little); + if (out.items.len + more > req.size) break; + out.appendSlice(p.gpa, q.buf.items[at + 4 ..][0..more]) catch break; + at += 4 + more; + } + } + return .{ .tag = req.tag, .payload = .{ .staged = @intCast(out.items.len) } }; } at += 4 + len; } |
