fix(twin): mirror inbound trunk audio across the twin link
When an external PAIRED=1 peer transmits to a twin pair, it picks a single sticky socket per transmission and sends every frame on it. The sticky-selected twin's TrunkLink::handleMsgPeerAudio used to broadcast locally and to satellites but never relayed to the partner twin — so local clients on the non-sticky twin were deaf to the audio even though the talker state was mirrored correctly. The satellite-receive path already had the symmetric forwarder (forwardSatelliteRawAudioToTwin); the trunk path was just missing it. Add Reflector::forwardTrunkAudioToTwin and forwardTrunkFlushToTwin, modelled on the satellite variants, and invoke them from TrunkLink::handleMsgPeerAudio and handleMsgPeerFlush after the local + satellite broadcasts. Loop safety: TwinLink::handleMsgPeerAudio does not re-forward to trunks, so there is no echo back to the originating peer. Requires the external peer to use PAIRED=1 with both twin hostnames in a single section — two independent trunk sections would defeat the source-trunk exclusion at the external owner and cause duplicates/echo. The docs now flag PAIRED=1 as mandatory for this topology. Test: test_twin.py::test_X4_paired_inbound_reaches_both_twins drives a refa client on TG 26201 and asserts both ref1 and ref2 receive audio frames and flush. Also rewrite test_01_twin_handshake and test_05_twin_wiring_no_errors to read /status.twin instead of scraping a 120s docker-logs window — the previous form flaked when the mesh had been up long enough for boot-time log lines to scroll off.
This commit is contained in:
1 parent
ef42da52de
commit
6a6cfadd95
6 files changed
+215
-35
No files matched your search
@@ -1170,6 +1170,12 @@ void TrunkLink::handleMsgPeerAudio(std::istream& is)
|
||||
// Forward trunk audio to connected satellites
|
||||
m_reflector->forwardAudioToSatellitesExcept(nullptr, local_tg, msg.audio());
|
||||
|
||||
// Mirror inbound trunk audio to the [TWIN] partner so PAIRED inbound
|
||||
// (sticky on one twin) still reaches the non-sticky twin's local clients
|
||||
// and its satellites. TwinLink::handleMsgPeerAudio does not re-forward to
|
||||
// trunks, so no echo back to the originating peer.
|
||||
m_reflector->forwardTrunkAudioToTwin(local_tg, msg.audio());
|
||||
|
||||
// Prefix-routed fanout (mirrors talker-start): only fan out if we have
|
||||
// a route. Cluster TGs without a prefix match stay single-hop.
|
||||
if (m_reflector->shouldRelayInbound(local_tg))
|
||||
@@ -1212,6 +1218,9 @@ void TrunkLink::handleMsgPeerFlush(std::istream& is)
|
||||
// Forward trunk flush to connected satellites
|
||||
m_reflector->forwardFlushToSatellitesExcept(nullptr, local_tg);
|
||||
|
||||
// Mirror flush to the [TWIN] partner — pairs with the audio mirror above.
|
||||
m_reflector->forwardTrunkFlushToTwin(local_tg);
|
||||
|
||||
// Prefix-routed fanout (mirrors talker-start): only fan out if we have
|
||||
// a route. Cluster TGs without a prefix match stay single-hop.
|
||||
if (m_reflector->shouldRelayInbound(local_tg))
|
||||
|
||||
Reference in new issue
Block a user