diff --git a/Sources/MWBCore/Switching.swift b/Sources/MWBCore/Switching.swift index aee7d4f..b8e66e8 100644 --- a/Sources/MWBCore/Switching.swift +++ b/Sources/MWBCore/Switching.swift @@ -241,10 +241,13 @@ public final class Switcher { /// Learns the sender of a `Heartbeat`, `Awake` or `Hello` /// (`AddToMachinePool`, `MachineStuff.cs:712-777`). /// - /// A known name just has its id and timestamp refreshed. A new name is - /// learned, the matrix is rebuilt from the pool so control is bidirectional - /// straight away (`:758-772`), and the caller is asked to persist, reconnect - /// and replicate. + /// A known name just has its id and timestamp refreshed — no actions at + /// all: the known-machine branch `return`s at `MachineStuff.cs:737`, before + /// the `UpdateMachinePoolStringSetting()` at `:755`, so Windows does not + /// write the pool to disk on every heartbeat from a peer it already knows. + /// A new name is learned, the matrix is rebuilt from the pool so control is + /// bidirectional straight away (`:758-772`), and only then is the caller + /// asked to persist, reconnect and replicate. public func learn(from packet: Packet, now: TimeInterval) -> [SwitchAction] { guard let name = packet.machineName, !name.isEmpty else { return [] } @@ -254,7 +257,7 @@ public final class Switcher { newDesMachineID = packet.src // MachineStuff.cs:731-735 setDesMachine(packet.src) } - return [.persistMachinePool] + return [] // MachineStuff.cs:737 } guard pool.learn(name, keeping: matrix) else { return [] } // "The 5th machine" diff --git a/docs/features/session-matrix/README.md b/docs/features/session-matrix/README.md index 919b08f..77bb029 100644 --- a/docs/features/session-matrix/README.md +++ b/docs/features/session-matrix/README.md @@ -80,9 +80,13 @@ the Windows source again. (`MachineStuff.cs:712-777`) adds to the pool and, when the name is new, rebuilds the matrix from the pool slot-for-slot so control is bidirectional at once, then queues the four `Matrix` packets — reported - as `SwitchAction`s, the app decides to persist and reconnect. This lives - on `Switcher`, not on `Session`: the pool and matrix are app-wide and a - session is per-connection. + as `SwitchAction`s, the app decides to persist and reconnect. A peer that + is **already** known produces **no actions**: Windows returns from that + branch at `MachineStuff.cs:737`, before the + `UpdateMachinePoolStringSetting()` at `:755`, so a heartbeat from a known + machine refreshes the in-memory id and timestamp and writes nothing. + This lives on `Switcher`, not on `Session`: the pool and matrix are + app-wide and a session is per-connection. - **Geometry uses `CGRect`/`CGPoint` from Foundation** (no CoreGraphics import) in the Windows convention: top-left origin, y down, integer pixels. The `input-capture` lane converts from CoreGraphics display