trunk: owner-relay received audio/flush/talker to other trunk peers
Trunks are meant to form a full audio mesh, but the previous code broadcast trunk-received audio only to local clients and satellites — never to other trunk peers. That made three-way conversations impossible whenever the speaker and the intended listener were both non-owners of the TG (e.g. refA and refC on a TG owned by refB). Now, when a TrunkLink receives MsgTrunkTalkerStart/Stop/Audio/Flush for a TG this reflector locally owns, Reflector re-forwards the event to every other trunk peer via the existing onLocal* filters (shared / cluster / peer-interest). Loop prevention: only the owner relays and the source link is excluded from the fanout, so it stays single-hop. isLocalTG(tg) performs longest-prefix-match across m_local_prefixes vs. m_all_prefixes — owner if our prefix wins globally.
This commit is contained in:
1 parent
962e1ffc10
commit
9f4011d3e2
3 files changed
+139
-2
No files matched your search
@@ -971,6 +971,15 @@ void TrunkLink::handleMsgTrunkTalkerStart(std::istream& is)
|
||||
m_peer_interested_tgs[local_tg] = std::time(nullptr);
|
||||
TGHandler::instance()->setTrunkTalkerForTG(local_tg, msg.callsign());
|
||||
m_reflector->notifyExternalTrunkTalkerStart(local_tg, m_section, msg.callsign());
|
||||
|
||||
// Owner-relay: if we own this TG, propagate the talker-start to every
|
||||
// other interested trunk peer so their local clients and our mesh-wide
|
||||
// audience learn about the remote talker.
|
||||
if (m_reflector->isLocalTG(local_tg))
|
||||
{
|
||||
m_reflector->forwardTrunkTalkerStartToOtherTrunks(this, local_tg,
|
||||
msg.callsign());
|
||||
}
|
||||
} /* TrunkLink::handleMsgTrunkTalkerStart */
|
||||
|
||||
|
||||
@@ -999,6 +1008,12 @@ void TrunkLink::handleMsgTrunkTalkerStop(std::istream& is)
|
||||
m_peer_active_tgs.erase(local_tg);
|
||||
TGHandler::instance()->clearTrunkTalkerForTG(local_tg);
|
||||
m_reflector->notifyExternalTrunkTalkerStop(local_tg, m_section);
|
||||
|
||||
// Owner-relay: propagate the talker-stop to every other interested peer.
|
||||
if (m_reflector->isLocalTG(local_tg))
|
||||
{
|
||||
m_reflector->forwardTrunkTalkerStopToOtherTrunks(this, local_tg);
|
||||
}
|
||||
} /* TrunkLink::handleMsgTrunkTalkerStop */
|
||||
|
||||
|
||||
@@ -1046,6 +1061,13 @@ void TrunkLink::handleMsgTrunkAudio(std::istream& is)
|
||||
|
||||
// Forward trunk audio to connected satellites
|
||||
m_reflector->forwardAudioToSatellitesExcept(nullptr, local_tg, msg.audio());
|
||||
|
||||
// Owner-relay: when the TG is ours, fan the audio out to every other
|
||||
// trunk peer that has interest (so mesh-wide audience hears the talker).
|
||||
if (m_reflector->isLocalTG(local_tg))
|
||||
{
|
||||
m_reflector->forwardTrunkAudioToOtherTrunks(this, local_tg, msg.audio());
|
||||
}
|
||||
} /* TrunkLink::handleMsgTrunkAudio */
|
||||
|
||||
|
||||
@@ -1075,6 +1097,13 @@ void TrunkLink::handleMsgTrunkFlush(std::istream& is)
|
||||
|
||||
// Forward trunk flush to connected satellites
|
||||
m_reflector->forwardFlushToSatellitesExcept(nullptr, local_tg);
|
||||
|
||||
// Owner-relay: when the TG is ours, fan the flush out to every other
|
||||
// trunk peer so their clients see end-of-stream as well.
|
||||
if (m_reflector->isLocalTG(local_tg))
|
||||
{
|
||||
m_reflector->forwardTrunkFlushToOtherTrunks(this, local_tg);
|
||||
}
|
||||
} /* TrunkLink::handleMsgTrunkFlush */
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user