Liveness + round-trip-time probing, built purely on PeerNetwork. More...
#include "node/peer_network.h"#include "peer/peer.h"#include "peer/peer_id.h"#include <atomic>#include <chrono>#include <condition_variable>#include <cstdint>#include <mutex>#include <optional>#include <thread>#include <unordered_map>Go to the source code of this file.
Classes | |
| class | librats::PingService |
Namespaces | |
| namespace | librats |
Liveness + round-trip-time probing, built purely on PeerNetwork.
The first real subsystem on the redesigned plugin model — and the template for porting the larger ones. It depends on NOTHING but the PeerNetwork contract: no Node, no reactor internals, no friend. Its own thread periodically pings every connected peer; a peer echoes the probe back, letting the sender measure RTT. Easily mocked by handing it a fake PeerNetwork in tests.
Wire format (MessageType::Ping payload): [tag:u8][token:8 bytes]. tag 0 = ping, tag 1 = pong. The 8 token bytes are echoed back verbatim, so the original sender decodes them in its own format (endianness irrelevant).
Definition in file ping_service.h.