node: source connection start/activity timestamps from the peer machine

The connection leg's started_at and last_activity duplicated the peer
machine's own connection-state copy. Make the machine copy the sole live
telemetry and timeout carrier: re-stamp it with the leg's provenance when
the leg is attached at handshake start (the msg1-prep clock, not the earlier
dial-time constructor value) and mirror the completion touch, then delete the
leg's last_activity/touch accessors and source the connection-row projection,
show_connections, and the timeout readers from the machine. Byte-identical
for all normal paths.
This commit is contained in:
Johnathan Corgan
2026-07-18 15:11:43 +00:00
parent 56bbc81a40
commit b3f2018fce
8 changed files with 95 additions and 22 deletions
+10 -3
View File
@@ -642,10 +642,17 @@ impl Node {
self.peer_machines.contains_key(&link_id),
"outbound msg1 prepared for link {link_id} with no dial-time machine"
);
self.peer_machines
let machine = self
.peer_machines
.entry(link_id)
.or_insert_with(|| PeerMachine::new_outbound(link_id, peer_identity, current_time_ms))
.set_leg(connection);
.or_insert_with(|| PeerMachine::new_outbound(link_id, peer_identity, current_time_ms));
// The dial-born machine carrier was stamped at dial; re-stamp it with the
// leg's msg1-prep clock so the surviving `started_at`/`last_activity`
// carry the leg's provenance. The two clocks differ when a connect
// round-trip separates dial from msg1 preparation.
machine.set_conn_started_at(current_time_ms);
machine.touch_conn(current_time_ms);
machine.set_leg(connection);
Ok(())
}