Expand description
Network quality monitor — Ping and Proof-of-Storage challenge loops.
§What it does
The monitor runs as a background Tokio task spawned by the daemon.
Ping loop (every 60 s):
- Reads the live
NetworkStateto enumerate all known Pouch peers. - Sends a
NetworkCommand::Pingfor each Pouch (fire-and-forget per peer). - Each Ping waits up to 5 seconds for a Pong from the network loop.
- On success: records the RTT into
QosRegistryviacrate::network::qos::PeerQos::record_pingandcrate::network::qos::PeerQos::record_challenge. - On timeout: records a timeout via
crate::network::qos::PeerQos::record_ping_timeoutand a failed challenge.
Proof-of-Storage loop (every 300 s):
- For each Pouch peer that has entries in
OutgoingAssignments: picks one random fragment ID assigned to that peer. - Sends a
NetworkCommand::ProofOfStoragechallenge. - Waits up to 10 s for a
boolproof result. - On success: calls
crate::network::qos::PeerQos::record_pos_success. - On failure/timeout: calls
crate::network::qos::PeerQos::record_pos_failure— incrementsfault_scoretoward thedegraded/suspected/blacklistedthresholds.
The QosRegistry populated here is consumed by PutFile in the control
server to compute adaptive k/n coding parameters.
§Concurrency model
All per-peer tasks within a round are spawned concurrently so a slow or dead peer does not delay the others.
Functions§
- run_
quality_ monitor - Run the quality monitor loop indefinitely.