session-matrix: learn() persists only when a new machine is learned
QA finding 2. AddToMachinePool returns inside the TryFindMachineByName branch (MachineStuff.cs:737), before the UpdateMachinePoolStringSetting() at :755 — which is reachable only from the fall-through "new machine" path. Switcher.learn was returning [.persistMachinePool] from the known branch too, asking the app to write MachinePool to disk on every heartbeat cadence tick from every already-known peer. It now returns []. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
1 parent
0e6ee77dc7
commit
e0638de0b9
2 files changed
+15
-8
No files matched your search
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user