feat(peer): passive-monitor support via MsgPeerTgInterest
A node that has selected a TG without keying, or marked it in monitoredTGs, never received any audio: peer interest was only populated by talker activity, and the local UDP fanout filtered by TgFilter alone (current TG match), ignoring monitor entries. Adds: - MsgPeerTgInterest (wire ID 129, peer_id + vector<uint32_t>) — each trunk peer advertises the union of its local clients' selected TG and monitoredTGs to peers whose prefix is the longest-prefix-match for the TG. Edge-triggered (500 ms debounce) on client connect / disconnect, MsgSelectTG, MsgTgMonitor, and trunk hello completion; 60 s periodic refresh as a safety net, skipping when the outgoing set is unchanged. The receiver writes mapTgIn(tg) into m_peer_interested_tgs so the existing send-side gates (isPeerInterestedTG, shouldRelayInbound + forwardTrunkAudioToOther Trunks) deliver audio without requiring a PTT to bootstrap. - Multi-hop propagation. Receivers re-advertise interest from other peers, prefix-filtered for the destination link and source-link excluded, so country-gateway-into-national-mesh layouts (§2) converge in one debounce per hop. Closes the gap where SE monitoring an Italian regional TG would never reach Z1 without IT 222 explicitly forwarding interest. - TgMonitorFilter applied at every local UDP fanout (audio + MsgUdpFlushSamples) — Reflector::onUdpFrameReceived and the local talker stop, the trunk receive path, and both directions of the satellite mirror. Without this, the protocol-level interest arrives at the right reflector but stops at its UDP fanout — the passive monitor still hears nothing. Strict superset: no existing delivery path is removed. Loop safety relies on filtering local-side MsgPeerTgInterest by isSharedTG (same gate as audio fanout). Advertising to non-owner peers would register ghost interest there, which gateway prefix routing would then relay back across the mesh. Verified by test_32_three_way_conversation (full mesh, no echo loops). Tests: new test_39_passive_monitor_multihop covers the §2 chain (SE-style monitor on a, talker on d, gateway b). All existing tests pass: 42 trunk + 7 mqtt-deltas + 6 logging + 14 twin = 69/69. Builds on the idea originally proposed in #4 by @sa2blv; the single-hop and wire-ID-collision issues described in the close comment are addressed in this rewrite.
This commit is contained in:
1 parent
ccf34adbe6
commit
a6618790bb
11 files changed
+496
-23
No files matched your search
@@ -53,10 +53,16 @@ forwards going down.
|
||||
|
||||
Two other behaviours show up repeatedly in the flow descriptions below:
|
||||
|
||||
- **Peer interest** is populated when a peer emits `PeerTalkerStart` /
|
||||
`PeerAudio` for a TG. Until that happens, the owner doesn't know to
|
||||
fan that TG back to that peer. Interest expires after **10 minutes** of
|
||||
inactivity on that TG from that peer (or immediately on trunk disconnect).
|
||||
- **Peer interest** is populated either when a peer emits `PeerTalkerStart`
|
||||
/ `PeerAudio` on a TG, or proactively when a peer advertises its local
|
||||
clients' selected / monitored TGs via `MsgPeerTgInterest` (type 129).
|
||||
The proactive path means a passive listener — a SvxLink node that has
|
||||
selected a foreign TG or added it to `monitoredTGs` without keying —
|
||||
registers as interested at the owner without first transmitting; the
|
||||
receiver re-advertises one hop further toward the owner so multi-hop
|
||||
national-mesh layouts (§2) propagate correctly. Interest expires after
|
||||
**10 minutes** of inactivity on that TG from that peer (or immediately
|
||||
on trunk disconnect).
|
||||
- **MCC-style country prefixes** are used for the international mesh:
|
||||
IT = `222`, SE = `240`, DE = `262`. Reusing the DMR MCC layout makes
|
||||
ownership self-documenting.
|
||||
@@ -152,7 +158,10 @@ section. SE only knows the prefixes it has trunks for: `222` (IT) and `262`
|
||||
route for `2222`). Z2 plays locally and fans the audio out to its national
|
||||
peers (excluding IT as the source). The return leg works the same way:
|
||||
audio from a Z3 client reaches SE because IT's `isPeerInterestedTG` for
|
||||
`22221` was registered on the SE side when SE's PTT first arrived.
|
||||
`22221` was registered on the SE side — either by a previous PTT from
|
||||
SE, or proactively as soon as the Swedish operator selected (or
|
||||
monitored) `22221` on their SvxLink node, via `MsgPeerTgInterest`
|
||||
(type 129).
|
||||
|
||||
> **Cluster TGs are for unowned TGs, not for cross-mesh routing.**
|
||||
> Gateway prefix routing handles foreign-to-regional reach automatically
|
||||
|
||||
Reference in new issue
Block a user