Expand description
Single-reflector XLX UDP JSON monitor client.
Each XlxMonitor manages a single UDP socket connected to one XLX
reflector’s monitor port (10001). The lifecycle is:
-
Connect:
XlxMonitor::connectbinds a local UDP socket, sends the"hello"handshake datagram, and returns the monitor handle. -
Receive:
XlxMonitor::recvawaits the next UDP datagram with a 30-second timeout, parses the JSON payload viaprotocol::parse, and returns the decodedMonitorMessage. A timeout returnsNone, signaling that the reflector may be unresponsive. -
Disconnect: drop the monitor. The
Dropimplementation sends a best-effort"bye"datagram so the reflector can clean up its client entry promptly rather than waiting for a timeout.
§Single-client limitation
Each XLX reflector monitor port accepts connections from any client, but
each XlxMonitor instance talks to exactly one reflector. To monitor
multiple reflectors, the orchestrator in super::run manages a pool of
monitors.
§Timeout behavior
The 30-second recv timeout is chosen to be 3x the xlxd update period (~10 seconds). If no data arrives within this window, the reflector is likely down or the network path is broken. The orchestrator can then decide to reconnect or replace the monitor.
§UDP socket binding
Each monitor binds to 0.0.0.0:0 (ephemeral port) because the XLX
monitor protocol is stateless from the server’s perspective — the server
tracks clients by source address, and each monitor needs its own port to
avoid datagram interleaving.
Structs§
- XlxMonitor 🔒
- A UDP client connected to a single XLX reflector’s monitor port.
Constants§
- MAX_
DATAGRAM_ 🔒SIZE - Maximum UDP datagram size for the XLX monitor protocol.
- RECV_
TIMEOUT 🔒 - Recv timeout: 3x the xlxd ~10-second update period.
- XLX_
MONITOR_ 🔒PORT - XLX monitor port as defined by the xlxd source code.