mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 08:14:42 +00:00
Move the outbound msg1 resend off the unconditional tick function onto the machine-armed retransmit timer. The per-peer machine already arms a HandshakeRetransmit deadline at dial; a new drive_peer_timers fires the due ones (kind-filtered to the retransmit timer) and homes the resend counter on the machine, where the operator-visible count now reads from. The resend decision reads the same operator config as before (interval, backoff, max), the wire bytes and transport target still come from the shell connection, and the pure core computes the backoff schedule. As with the deleted resend_pending_handshakes, the count and reschedule advance only on a successful send: a failed send neither advances the count nor marks the connection failed, it just retries on the next tick. The handshake-timeout timer stays on the legacy check_timeouts path, and the rekey/liveness timers keep their own shell drivers, so drive_peer_timers deliberately fires only the retransmit kind. The show_connections resend count is relocated to read from the machine (the counter's new home) via connection_resend_count; machine-less and inbound connections report 0, matching what the shell connection reported before. Delete resend_pending_handshakes and resend_candidates (the latter also from the LifecycleView trait, its only user). The resend unit test is re-expressed against the machine + timer path, covering the due check and the record-on-success semantics. Known limitation: the first resend interval is armed from the machine's hardcoded 1000ms constant, which equals the config default. Under an operator override of handshake_resend_interval_ms the first resend diverges from the pre-change dial+interval; subsequent resends and the cap remain config-driven. Neutralizing the first-resend override needs the interval threaded into the sync core (the shell arm would be clobbered by the machine's own timer arming at dial), deferred to when the connection and machine entities merge. Test count unchanged at 1631.