twin: fan twin partner roster into MQTT and Redis

Route the twin-received MsgTrunkNodeList through
Reflector::onPeerNodeList() — the same fan-out TrunkLink uses —
so MQTT publishes nodes/<peer_id> and Redis pushPeerNode entries
also cover the twin partner, not just trunk peers.

Before this, /status exposed twin.nodes but MQTT/Redis did not;
consumers reading only from Redis or MQTT missed the roster of
the twin partner entirely.

On twin link-down, clearPartnerRosterIfInactive() pushes an
empty list so onPeerNodeList's tombstone path clears Redis /
empties the MQTT topic — matching the cleanup we do for a
trunk peer that goes down.
This commit is contained in:
Audric committed 2026-04-18 23:49:34 +02:00
1 parent fa6f137e1c
commit cadc5c5aa2
2 files changed
+26

No files matched your search

+6
View File
@@ -111,6 +111,11 @@ class TwinLink
uint16_t partnerPort(void) const { return m_peer_port; }
const std::string& secret(void) const { return m_secret; }
const std::string& localPrefix(void) const { return m_local_prefix; }
const std::string& peerId(void) const
{
return m_peer_id_received.empty() ? m_peer_id_config
: m_peer_id_received;
}
Json::Value statusJson(void) const;
@@ -158,6 +163,7 @@ class TwinLink
void handleMsgTrunkFlush(std::istream& is);
void handleMsgTrunkHeartbeat(void);
void handleMsgTrunkNodeList(std::istream& is);
void clearPartnerRosterIfInactive(void);
void handleMsgTwinExtTalkerStart(std::istream& is);
void handleMsgTwinExtTalkerStop(std::istream& is);
void heartbeatTick(Async::Timer*);