fix(peer-client): plumb peer_id through Satellite talker paths

Satellite{Link,Client}::handleMsgPeerTalkerStart was calling
setTrunkTalkerForTG without recording peer_id, so the
trunkTalkerUpdated signal fired with peer_id="" and the new
peer/<id>/talker/<tg>/start MQTT topic became peer//talker/...
(malformed empty segment).

Use setTrunkTalkerForTGViaPeer with m_satellite_id / m_parent_id
so the topic is properly namespaced.

Also add a defensive early-return in MqttPublisher::onPeerTalker*
that logs a warning and skips the publish if peer_id is empty —
protects against future callers that emit signals without peer
attribution (e.g. TwinLink, addressed in Task 7).
This commit is contained in:
Audric committed 2026-04-28 19:59:32 +02:00
1 parent af746d7534
commit 1bb847b3c8
3 files changed
+16 -2

No files matched your search

+12
View File
@@ -266,6 +266,12 @@ void MqttPublisher::onPeerTalkerStart(const std::string& peer_id,
uint32_t tg,
const std::string& callsign)
{
if (peer_id.empty())
{
geulog::warn("mqtt", "Skipping onPeerTalkerStart with empty peer_id"
" (tg=", tg, " callsign='", callsign, "')");
return;
}
Json::Value payload;
payload["callsign"] = callsign;
payload["tg"] = static_cast<Json::UInt>(tg);
@@ -280,6 +286,12 @@ void MqttPublisher::onPeerTalkerStop(const std::string& peer_id,
uint32_t tg,
const std::string& callsign)
{
if (peer_id.empty())
{
geulog::warn("mqtt", "Skipping onPeerTalkerStop with empty peer_id"
" (tg=", tg, " callsign='", callsign, "')");
return;
}
Json::Value payload;
payload["callsign"] = callsign;
payload["tg"] = static_cast<Json::UInt>(tg);
+2 -1
View File
@@ -340,7 +340,8 @@ void SatelliteClient::handleMsgPeerTalkerStart(std::istream& is)
// Register as trunk talker — fires trunkTalkerUpdated which
// broadcasts MsgTalkerStart to local clients
TGHandler::instance()->setTrunkTalkerForTG(msg.tg(), msg.callsign());
TGHandler::instance()->setTrunkTalkerForTGViaPeer(msg.tg(), msg.callsign(),
m_parent_id);
} /* SatelliteClient::handleMsgPeerTalkerStart */
+2 -1
View File
@@ -339,7 +339,8 @@ void SatelliteLink::handleMsgPeerTalkerStart(std::istream& is)
// local clients. Reflector::onTrunkTalkerUpdated also forwards to
// other satellites and trunk peers.
m_sat_active_tgs.insert(tg);
TGHandler::instance()->setTrunkTalkerForTG(tg, msg.callsign());
TGHandler::instance()->setTrunkTalkerForTGViaPeer(tg, msg.callsign(),
m_satellite_id);
// Forward to trunk peers
m_reflector->forwardSatelliteAudioToTrunks(tg, msg.callsign());