pub struct LinkState {Show 13 fields
pub handshake_sent: bool,
pub snapshot_sent: bool,
pub told: HashMap<String, u64>,
pub last_data_send_ms: Option<u64>,
pub send_jitter_ms: u64,
pub self_interval_secs: u32,
pub last_backoff_applied_ms: Option<u64>,
pub phase: RecvPhase,
pub remote_declared_secs: Option<u32>,
pub last_arrival_ms: Option<u64>,
pub strikes: u32,
pub muted: bool,
pub received: HashMap<String, u64>,
}Expand description
All PEX state for one link (both directions). Created on link_up / first inbound message and
discarded on link_down (SPEC §5.5).
Fields§
§handshake_sent: boolWhether we have sent our pex_handshake on this link.
snapshot_sent: boolWhether we have sent our one pex_snapshot on this link.
told: HashMap<String, u64>Per-link told-state (SPEC §9.1): peer_id → advertised-content fingerprint hash
(PeerEntry::fingerprint_hash, a Copy,
allocation-free u64 rather than the display-oriented String form — #179 MED optimization).
Deltas are computed relative to this; an unchanged told entry is never re-advertised.
last_data_send_ms: Option<u64>When we last sent a data message (snapshot or delta) on this link, in now_ms. None
until the snapshot goes out; the cadence spaces subsequent sends from here (SPEC §6.1).
send_jitter_ms: u64The additive jitter (ms) drawn for the current schedule interval (SPEC §6.3).
self_interval_secs: u32Our own declared interval (seconds) for this link — starts at the configured value and MAY
double on receiving pex_error code 3 (SPEC §6.4), capped at PEX_MAX_INTERVAL.
last_backoff_applied_ms: Option<u64>When a pex_error code-3 back-off was last actually applied to self_interval_secs, in
now_ms (LOW #179 fix). Bounds how often an unauthenticated pex_error can move our send
cadence: a further code-3 is honored at most once per (pre-doubling) effective interval, so a
peer spamming code-3 cannot ratchet the interval to PEX_MAX_INTERVAL faster than a single
genuine violation could.
phase: RecvPhaseThe inbound state machine (SPEC §5.3).
remote_declared_secs: Option<u32>The remote’s handshake-declared interval (seconds), once its handshake arrived. Used as the arrival-floor basis (SPEC §6.4) and as a spacing floor for our own sends (SPEC §6.2).
last_arrival_ms: Option<u64>When the last inbound data message arrived, in now_ms — the SPEC §6.4 clock.
strikes: u32Violation strikes counted on the incoming direction (SPEC §11.2).
muted: boolWhether the incoming direction is muted (all further inbound PEX ignored) — SPEC §5.2, §11.2.
received: HashMap<String, u64>peer_ids this link has told us (via snapshot / delta added) — so a later dropped can be
attributed to it and ignored for ids it never told us (SPEC §4.4, §8.3).