summaryrefslogtreecommitdiff
path: root/core/Core.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 01:00:47 -0300
committerGabriel Schneider <[email protected]>2026-11-21 01:08:24 -0300
commit76565c605defb03ab6aa8300b93f306054a67efd (patch)
tree706cc64e23ae33ec6be1d6b9164750ba42da712b /core/Core.zig
parent6d937cd125ca04a2edb92b2d014014ee6c2eb45d (diff)
parentdac87eaa1d57acfc5b2dd8427e7fbacfe065e613 (diff)
downloadpardes-76565c605defb03ab6aa8300b93f306054a67efd.tar.gz
pardes-76565c605defb03ab6aa8300b93f306054a67efd.zip
integration: the terminals' side line on the landed main: pardes-term-join-4 (terminals by the pty's bytes: a client's emulator fed the session's bytes, reload at a join, the lag bound; the query rows' paint decided on replicated state; views.park's leak; a view kept for its client's rejoin; C and Alt-C on a long text walking on from the row last tried: 306 G instructions to 194 M; the soak's witness and watchdog) and main (pardes-new-upgrade); seven conflicts: the wire's version (the side line's 24 is 26 here: 24 is the bye's close byte, 25 the 9P state), Peers' join (the view typed, the lag limit a field's default), a peer's end (the view's index; cut joins again), the client's and the soak's bye (the struct, again or lagged), daemon.py's WIRE; three more the compiler found (a test's view typed: its index where a u8 is asked)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Core.zig')
-rw-r--r--core/Core.zig23
1 files changed, 16 insertions, 7 deletions
diff --git a/core/Core.zig b/core/Core.zig
index 55b3682f..d2cfadfc 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -127,6 +127,9 @@ pub const View = struct {
/// pane (util.c:467). Where the acme placement puts new panes
/// (layout.placeNew). A Look click moves the keyboard but not this.
active_column: u32 = 0,
+ /// When its client went away to join again for it (Views.away), on
+ /// the session's clock.
+ away_ns: u64 = 0,
/// The live view's frontend (Event.frontend): a window, what it draws and
/// the words it takes (builtins.zig `here`); it starts as
/// `Options.windowed` says.
@@ -1161,21 +1164,27 @@ pub inline fn view(p: anytype) if (@typeInfo(@TypeOf(p)).pointer.attrs.@"const")
pub const openView = pardes.tape.taped(openViewInner);
fn openViewInner(p: *Pardes) ?View.Id {
// Every view taken: one kept for a client that has not come back
- // for it (Views.away) goes first. ponytail: no timer lets one go;
- // until its place is wanted it costs a parked slot, and a terminal
- // it sized last keeps that size until another view types into it.
- if (@popCount(p.views_open) == Views.max and p.views_away != 0) {
- Views.close(p, @ctz(p.views_away));
+ // for it in Views.away_kept_ns (Views.away) goes first; one kept
+ // since is its client's, and the join is refused. ponytail: no timer
+ // lets one go; until its place is wanted it costs a parked slot, and
+ // a terminal it sized last keeps that size until another view types
+ // into it.
+ if (@popCount(p.views_open) == Views.max) for (0..Views.max) |k| {
+ if (!Views.isAway(p, @intCast(k)) or p.clock.now_ns -| p.views[k].?.away_ns < Views.away_kept_ns) continue;
+ Views.close(p, @intCast(k));
p.sync();
- }
+ break;
+ };
// What was queued since the last pump (a leaving client's view
// closed, a 9P request's step) done first, as every client of the
// tape does it here: a join dumps the session next, and a core
// loaded from a dump has no queue (Replica.initDump).
p.settle();
+ // A join refused (every view taken) reloads nothing.
+ const k = Views.open(p) orelse return null;
pardes.panes.reloadTerminals(p);
p.needs_frame = true;
- return .at(Views.open(p) orelse return null);
+ return .at(k);
}
/// The client of view `k` gone: its view goes, the others stay. The