mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 16:24:45 +00:00
Reorganize the MMP subsystem, behavior unchanged throughout: - Restore the pre-migration role split: move SenderState into sender.rs, ReceiverState (with its GapTracker helper) into receiver.rs, MmpMetrics and RrLog into metrics.rs, and PathMtuState into path_mtu.rs, leaving the Mmp aggregate plus the peer/session state in state.rs (1339 to 196 lines). Home the module constants in a new limits.rs and re-export them at the same paths. Pure code-motion with module rewiring; visibility unchanged. - Dissolve the 97-line src/mmp shell, which held only MmpConfig and the monotonic mono_ms() clock: move MmpConfig into config/node.rs (re-exported as crate::config::MmpConfig), move mono_ms() into a new top-level src/time.rs shell time seam, repoint all callers, and delete src/mmp/. Also correct stale src/mmp/ doc-comment path labels to proto/mmp/ where they name the protocol primitives.
17 lines
665 B
Rust
17 lines
665 B
Rust
//! Shell-side time seam: the process-monotonic millisecond clock the sans-IO
|
|
//! cores take as an injected `u64`.
|
|
|
|
use std::sync::LazyLock;
|
|
use std::time::Instant;
|
|
|
|
/// Monotonic millisecond clock for the MMP time seam.
|
|
///
|
|
/// The owned `proto::mmp` state takes injected `u64` milliseconds rather than
|
|
/// reading a clock. The shell reads this process-monotonic clock at each edge
|
|
/// and passes the value in; only deltas between two `mono_ms()` reads are ever
|
|
/// compared, so the (process-relative) epoch is immaterial.
|
|
pub(crate) fn mono_ms() -> u64 {
|
|
static START: LazyLock<Instant> = LazyLock::new(Instant::now);
|
|
START.elapsed().as_millis() as u64
|
|
}
|