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:
Audric committed 2026-05-14 19:37:44 +02:00
1 parent ef42da52de
commit 6a6cfadd95
6 files changed
+215 -35

No files matched your search

+10
View File
@@ -360,6 +360,16 @@ both endpoints in their `HOSTS` setting for transparent failover. See
sticky-selects one per frame, with instant failover on socket failure.
```
> **Mandatory: every external reflector trunking to a twin pair MUST use
> `PAIRED=1` with both twin hostnames in a single section.** Configuring
> two independent trunk sections (one per twin) is a misconfiguration:
> the external peer's owner-relay no longer sees the pair as one logical
> entity, so source-trunk exclusion fails and audio is delivered both via
> the second trunk *and* via the intra-pair twin-mirror — causing
> duplicates on the partner twin and an echo back to the original
> talker. The `PAIRED=1` form is the only way to keep the pair
> single-logical from outside.
**What's different from trunk and satellite.**
| Property | Trunk | Satellite | Twin |