fix(twin): deliver mirrored trunk audio to monitor-only twin clients

TwinLink::handleMsgPeerAudio and handleMsgPeerFlush broadcast to local
clients with a selected-only TgFilter, whereas the sibling receive paths
(TrunkLink, SatelliteLink, SatelliteClient) use the composite
selected-OR-(passive-observer monitor) filter. TwinLink was the lone
outlier — the bare filter was copied in when the trunk->twin mirror was
added (6a6cfad) without the monitor arbitration the other paths already had.

When a PAIRED external peer that OWNS a TG fans audio into a twin pair it
picks a single sticky socket, so the non-sticky twin only receives that
audio via the trunk->twin mirror. A monitor-only listener on the non-sticky
twin was silently dropped, while a selecting listener there (and any
listener on the sticky twin, which gets the direct trunk path) heard fine.
Reported in the field on a 255/256 twin+single deployment: clients
monitoring the single peer's TG were silent on one twin and fine on the other.

- TwinLink::handleMsgPeerAudio / handleMsgPeerFlush: use the same composite
  selected-OR-monitor filter as TrunkLink, preserving the passive-observer /
  earliest-monitor-talker arbitration.
- tests: test_X5_paired_inbound_owner_tg_reaches_monitoring_twin_clients —
  mirror image of test_X4 (TG owned by the remote PAIRED peer; selecting and
  monitoring receivers on both twins). Red before the fix, green after.
- topology.py: add two test users (N0FOUR, N0FIVE) so the test can place
  five distinct callsigns.
This commit is contained in:
Audric committed 2026-05-24 12:03:53 +02:00
1 parent b268bfe595
commit f1d4afd032
3 files changed
+135 -4

No files matched your search

+25 -4
View File
@@ -618,9 +618,21 @@ void TwinLink::handleMsgPeerAudio(std::istream& is)
return;
}
if (msg.audio().empty()) return;
const uint32_t tg = msg.tg();
MsgUdpAudio udp_msg(msg.audio());
m_reflector->broadcastUdpMsg(udp_msg, ReflectorClient::TgFilter(msg.tg()));
m_reflector->forwardAudioToSatellitesExcept(nullptr, msg.tg(), msg.audio());
// Deliver to clients with this TG selected AND to passive monitors of it,
// matching TrunkLink::handleMsgPeerAudio. A plain selected-only TgFilter
// silently dropped monitor-only listeners on the non-sticky twin when the
// audio arrived via the trunk->twin mirror (see test_X5).
m_reflector->broadcastUdpMsg(udp_msg,
ReflectorClient::mkOrFilter(
ReflectorClient::TgFilter(tg),
ReflectorClient::mkAndFilter(
ReflectorClient::TgMonitorFilter(tg),
ReflectorClient::mkAndFilter(
ReflectorClient::PassiveObserverFilter(),
ReflectorClient::EarliestMonitorTalkerFilter(tg)))));
m_reflector->forwardAudioToSatellitesExcept(nullptr, tg, msg.audio());
} /* TwinLink::handleMsgPeerAudio */
@@ -632,9 +644,18 @@ void TwinLink::handleMsgPeerFlush(std::istream& is)
geulog::error("twin", "TWIN: Failed to unpack MsgPeerFlush");
return;
}
const uint32_t tg = msg.tg();
// Pairs with the audio mirror above — same selected-OR-monitor filter so a
// monitor-only listener on the non-sticky twin also gets the flush.
m_reflector->broadcastUdpMsg(MsgUdpFlushSamples(),
ReflectorClient::TgFilter(msg.tg()));
m_reflector->forwardFlushToSatellitesExcept(nullptr, msg.tg());
ReflectorClient::mkOrFilter(
ReflectorClient::TgFilter(tg),
ReflectorClient::mkAndFilter(
ReflectorClient::TgMonitorFilter(tg),
ReflectorClient::mkAndFilter(
ReflectorClient::PassiveObserverFilter(),
ReflectorClient::EarliestMonitorTalkerFilter(tg)))));
m_reflector->forwardFlushToSatellitesExcept(nullptr, tg);
} /* TwinLink::handleMsgPeerFlush */