sat: full partner-node parity across reflector + satellites

Extends MsgTrunkNodeList (type 121) with a 7th vector `sat_ids` so a
parent reflector can advertise both its own clients (sat_id="") and
clients learned from each connected satellite (sat_id=<satellite_id>)
in a single message. The sat_id is recipient-relative — empty means
"on whoever sent this list" — so the same field is reused on the
trunk, twin and satellite paths without a global namespace.

Reflector::sendNodeListToAllPeers now builds a combined view (parent-
local + every connected satellite's stamped roster) and fans it out:
  - to trunks and twin: full combined list
  - to each satellite: combined minus that sat's own contribution,
    additionally filtered by SATELLITE_FILTER (self-echo guard +
    audio-path scoping)
  - up to the parent (when running as a satellite): local clients only

SatelliteLink (parent side) and SatelliteClient (sat side) gain
sendNodeList / handleMsgTrunkNodeList wired into the type-121 dispatch.
Parent stamps each ingested entry with the SatelliteLink's id, then
schedules a debounced re-broadcast so trunk peers and sibling sats see
the new contribution. /status now exposes:
  - parent: /status.satellites[<id>].nodes (per-sat partner roster)
  - parent: /status.trunks[*].nodes[*].sat_id (attribution)
  - satellite: /status.satellite.parent_nodes (parent's combined view)

Result: refA, S1, S2 all render the same set of callsigns, with each
entry tagged so consumers can tell where it physically lives.

Wire-format note: this is the second lockstep bump on type 121 within
~24h of a3757ca. Peers running an older fork build will fail to unpack
and silently empty their partner roster until upgraded; pre-jay peers
keep ignoring it.

Tests: 35 → 39. Three /status-level checks (sat-attached client visible
on parent, on far-trunk peer with sat_id, parent-local visible on
satellite) plus a multi-sat wire-level cross-visibility test that
verifies sat_id stamping and the self-echo guard.
This commit is contained in:
Audric committed 2026-04-28 15:11:40 +02:00
1 parent d9ec356f10
commit 3d281e16d7
10 files changed
+761 -41

No files matched your search

+24 -1
View File
@@ -10,9 +10,9 @@
#include <AsyncTimer.h>
#include "TgFilter.h"
#include "ReflectorMsg.h"
class Reflector;
class ReflectorMsg;
/**
@brief Handles one inbound satellite connection on the parent reflector
@@ -55,6 +55,22 @@ class SatelliteLink : public sigc::trackable
void onParentAudio(uint32_t tg, const std::vector<uint8_t>& audio);
void onParentFlush(uint32_t tg);
// Send a node list down to the satellite. Caller passes the combined
// parent-known roster minus this satellite's own contribution; this
// method additionally drops entries whose TG falls outside the
// satellite's announced filter (if any).
void sendNodeList(
const std::vector<MsgTrunkNodeList::NodeEntry>& nodes);
// Read-only access to the satellite-supplied roster (this satellite's
// local clients), already sanitised and stamped with sat_id =
// satelliteId(). Used by Reflector to merge into the parent's
// outbound advertisements.
const std::vector<MsgTrunkNodeList::NodeEntry>& partnerNodes(void) const
{
return m_partner_nodes;
}
private:
static const unsigned HEARTBEAT_TX_CNT_RESET = 10;
static const unsigned HEARTBEAT_RX_CNT_RESET = 15;
@@ -69,6 +85,12 @@ class SatelliteLink : public sigc::trackable
unsigned m_hb_rx_cnt;
std::set<uint32_t> m_sat_active_tgs;
TgFilter m_tg_filter;
// Roster of clients attached to this satellite, learned via
// MsgTrunkNodeList from the satellite. Each entry carries
// sat_id == m_satellite_id (stamped on ingest) so the Reflector can
// merge it into outbound trunk/twin/sibling-sat lists with correct
// attribution.
std::vector<MsgTrunkNodeList::NodeEntry> m_partner_nodes;
void onFrameReceived(Async::FramedTcpConnection* con,
std::vector<uint8_t>& data);
@@ -79,6 +101,7 @@ class SatelliteLink : public sigc::trackable
void handleMsgTrunkFlush(std::istream& is);
void handleMsgTrunkHeartbeat(void);
void handleMsgTrunkFilter(std::istream& is);
void handleMsgTrunkNodeList(std::istream& is);
bool filterPassesTg(uint32_t tg) const;
void sendMsg(const ReflectorMsg& msg);
void heartbeatTick(Async::Timer* t);