feat(reflector): activate fanoutClient* across satellite+twin links
Replaces the no-op stubs from Task 4. Per-client liveness deltas
(MsgPeerClient{Connected,Disconnected,Rx,Status}) now flow over
satellite (parent->sat and sat->parent) and twin links. Trunk peers
are intentionally skipped — see spec §3 for the routing rationale.
Each receiving reflector republishes the events on its own MQTT
broker as peer/<peer_id>/client/<call>/<event>, retained for rx
and status, ephemeral for connect and disconnect.
This commit is contained in:
1 parent
6f407a5a77
commit
24a4bc98f9
2 files changed
+66
-10
No files matched your search
@@ -3148,32 +3148,89 @@ void Reflector::fanoutClientConnected(const std::string& callsign,
|
|||||||
uint32_t tg,
|
uint32_t tg,
|
||||||
const std::string& ip)
|
const std::string& ip)
|
||||||
{
|
{
|
||||||
// Stub — real iteration over m_satellite_con_map / m_satellite_client /
|
for (auto& kv : m_satellite_con_map)
|
||||||
// m_twin_link is added in Task 8 of the peer-client-liveness plan.
|
{
|
||||||
(void)callsign; (void)tg; (void)ip;
|
if (kv.second != nullptr)
|
||||||
|
{
|
||||||
|
kv.second->sendClientConnected(callsign, tg, ip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_satellite_client != nullptr)
|
||||||
|
{
|
||||||
|
m_satellite_client->sendClientConnected(callsign, tg, ip);
|
||||||
|
}
|
||||||
|
if (m_twin_link != nullptr)
|
||||||
|
{
|
||||||
|
m_twin_link->sendClientConnected(callsign, tg, ip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Reflector::fanoutClientDisconnected(const std::string& callsign)
|
void Reflector::fanoutClientDisconnected(const std::string& callsign)
|
||||||
{
|
{
|
||||||
// Stub — see Task 8.
|
for (auto& kv : m_satellite_con_map)
|
||||||
(void)callsign;
|
{
|
||||||
|
if (kv.second != nullptr)
|
||||||
|
{
|
||||||
|
kv.second->sendClientDisconnected(callsign);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_satellite_client != nullptr)
|
||||||
|
{
|
||||||
|
m_satellite_client->sendClientDisconnected(callsign);
|
||||||
|
}
|
||||||
|
if (m_twin_link != nullptr)
|
||||||
|
{
|
||||||
|
m_twin_link->sendClientDisconnected(callsign);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Reflector::fanoutClientRx(const std::string& callsign,
|
void Reflector::fanoutClientRx(const std::string& callsign,
|
||||||
const Json::Value& rx_json)
|
const Json::Value& rx_json)
|
||||||
{
|
{
|
||||||
// Stub — see Task 8.
|
Json::StreamWriterBuilder wb;
|
||||||
(void)callsign; (void)rx_json;
|
wb["indentation"] = "";
|
||||||
|
std::string s = Json::writeString(wb, rx_json);
|
||||||
|
for (auto& kv : m_satellite_con_map)
|
||||||
|
{
|
||||||
|
if (kv.second != nullptr)
|
||||||
|
{
|
||||||
|
kv.second->sendClientRx(callsign, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_satellite_client != nullptr)
|
||||||
|
{
|
||||||
|
m_satellite_client->sendClientRx(callsign, s);
|
||||||
|
}
|
||||||
|
if (m_twin_link != nullptr)
|
||||||
|
{
|
||||||
|
m_twin_link->sendClientRx(callsign, s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Reflector::fanoutClientStatus(const std::string& callsign,
|
void Reflector::fanoutClientStatus(const std::string& callsign,
|
||||||
const Json::Value& status_json)
|
const Json::Value& status_json)
|
||||||
{
|
{
|
||||||
// Stub — see Task 8.
|
Json::StreamWriterBuilder wb;
|
||||||
(void)callsign; (void)status_json;
|
wb["indentation"] = "";
|
||||||
|
std::string s = Json::writeString(wb, status_json);
|
||||||
|
for (auto& kv : m_satellite_con_map)
|
||||||
|
{
|
||||||
|
if (kv.second != nullptr)
|
||||||
|
{
|
||||||
|
kv.second->sendClientStatus(callsign, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_satellite_client != nullptr)
|
||||||
|
{
|
||||||
|
m_satellite_client->sendClientStatus(callsign, s);
|
||||||
|
}
|
||||||
|
if (m_twin_link != nullptr)
|
||||||
|
{
|
||||||
|
m_twin_link->sendClientStatus(callsign, s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -286,7 +286,6 @@ class Reflector : public sigc::trackable
|
|||||||
// Per-client liveness fanout to satellite and twin peers. Iterates
|
// Per-client liveness fanout to satellite and twin peers. Iterates
|
||||||
// m_satellite_con_map, m_satellite_client, and m_twin_link. Trunk
|
// m_satellite_con_map, m_satellite_client, and m_twin_link. Trunk
|
||||||
// peers are intentionally NOT fanned out (deferred per design spec).
|
// peers are intentionally NOT fanned out (deferred per design spec).
|
||||||
// Bodies are stubs in this commit and become real iteration in Task 8.
|
|
||||||
void fanoutClientConnected(const std::string& callsign, uint32_t tg,
|
void fanoutClientConnected(const std::string& callsign, uint32_t tg,
|
||||||
const std::string& ip);
|
const std::string& ip);
|
||||||
void fanoutClientDisconnected(const std::string& callsign);
|
void fanoutClientDisconnected(const std::string& callsign);
|
||||||
|
|||||||
Reference in new issue
Block a user