A failed login (REG_ACL / unregistered ID), a callsign mismatch or one
hotspot closing down set _reset on the whole system. With many hotspots
on one MASTER that dropped the next frame routed to it ("disallow
transmission until reset cycle is complete", which also stops a plugin
announcement as "slot taken"), and BRIDGERESET then set every leg of the
system IDLE: calls the other hotspots were listening to stopped and
their dynamic TGs were gone until someone keyed up again.
Seen on 2131 at 20:00:15 UTC: an invalid login from ID 2131 cut the
hourly announcement at packet 113/115, and the reset 5 s later stopped a
TG 21472 over a connected hotspot was receiving (it arrived over OBP
with 0.42 % loss and ran 5 s longer). 64 such resets in 24 h there.
All paths now do what the peer timeout already did: restore the default
OPTIONS and set _reset only when no peer is left.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
The trigger checked the slot's RX_TYPE after the terminator had already set
it to VTERM, so it never fired. It now reads the RX_TYPE from before the
frame, as legacy did, and only for on-demand service calls.
Routed voice on the MASTER slot's TX leg no longer stops a plugin announcement,
and a frame routing refuses is still played to the MASTER's hotspots: only a
radio or another stream on the RX leg stops it, as with the core announcements.
Reverts the global slot hold from #120, which cut the start of other calls for
every hotspot of the MASTER while an announcement played.
A remote caller's next over may reach this server first over another
OpenBridge link, so within the hold window it looked like an echo (8 of
3262 call starts on 2131, all OBP -> OBP re-keys). The mesh is now one
ingress: a real loop is still caught where the caller is local (HBP vs a
bridge peer, or HBP vs the mesh), and so is a local bridge peer echoing a
remote caller (the mesh vs HBP).
Show GLOBAL.LOOP_GUARD_HOLD and SYSTEM LOOP_GUARD with their defaults in
adn-server.example.yaml.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
Since announcements moved to the voice-announcements plugin they enter the
MASTER as a synthetic RX leg instead of stamping the slot's TX row. Routing
re-applies the global MASTER slot contention only when
master_slot_holds_server_broadcast() sees that TX row, so a call on another
TG bridged to the same slot (from OpenBridge, or with more than one hotspot
connected) skipped the contention and took the slot's TX leg. The next
announcement frame was then refused as "slot taken (QSO)" and the playback
stopped after a few seconds; on a busy server announcements were rarely heard
whole.
Plugin ingress now names its stream on the slot (PLUGIN_RX_STREAM_ID) and
routing applies the contention while that stream holds the RX leg, as it did
for the core announcements.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- playback_use_cases: _PLAYBACK_DELAY_S becomes public PLAYBACK_DELAY_S
(now used outside the module); the two echo tests that import it follow.
- loop_guard: MAX_LOOP_GUARD_HOLD_S = PLAYBACK_DELAY_S, so changing the
parrot's delay moves the cap with it. playback_use_cases only imports
from domain: no cycle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- The parrot replays an over 2.0 s after it ends (_PLAYBACK_DELAY_S),
under whatever system/TG name the sysop chose. A bridge echo starts
while the original is still on air, so the hold only has to cover very
short overs: default 1.0 s, and the validator rejects 2.0 s or more.
The runtime falls back to the default for anything out of range.
- LOOP_GUARD: false stays as an extra option.
- Test: a replay starting 2.0 s after the over ends is not flagged even
with LOOP_GUARD: true on that system.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- application/routing/loop_guard.py: when a group voice stream starts,
the same rf_src on the same TG from another ingress (system + peer; an
OBP link is one ingress), with another stream ID, while the original is
active or ended < GLOBAL.LOOP_GUARD_HOLD (2 s), is a loop echo.
Stream-ID LoopControl cannot see it (bridges start a new stream ID) and
the TG-busy check lets the same caller through on purpose.
- Bridges that relay to another TG are left alone (same TG required).
- Per system LOOP_GUARD: "log" (default, one *LoopGuard* line per echo),
true (drop), false (neither checked nor recorded: the ECHO parrot).
- Called from HBP and OBP ingress and from the MASTER local REPEAT, one
verdict per stream cached by stream ID; bound streams never reach it.
Server voice IDs and plugin/announcement frames are exempt.
- Validator: LOOP_GUARD true/false/"log", LOOP_GUARD_HOLD > 0.
- Docs: configuration.md and behaviour-and-timers.md (en/es); the example
ECHO sets LOOP_GUARD: false.
Closes#118
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- udp_hbp.py decides once per config, in __init__ and
apply_system_config (SIGHUP reload), and the two ingress write sites
test self._learns_sub_map before the direct assignment.
system_learns_sub_map stays the single place that decides;
_pvt_call_received keeps learn_sub_map.
- Tests switch the flag through apply_system_config, as a reload does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- When SUB_MAP (or the 6/7-digit hotspot-ID fallback) points the
destination at the very peer the frame came from, the two radios are on
the same hotspot and hear each other on RF; sending it back made the
hotspot transmit over their exchange and the SMS ACK was lost. Applies
to every peer: a duplex repeater already retransmits its own RF.
- Plugin frames carry SERVER_ID as peer, so they are never skipped.
- The same-system private call log line is the normal path, not an
error: logger.error -> logger.debug.
Closes#116
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- SUB_MAP_LEARN: false on a MASTER or PEER keeps traffic entering through
it from updating SUB_MAP, so a beacon, a bridge or the parrot never
becomes where a subscriber is reached for private calls and unit data.
Default true everywhere, no name-based default.
- One function, learn_sub_map, decides and writes for the three write
sites (MASTER ingress, PEER ingress, _pvt_call_received).
- OpenBridge always learns; the validator rejects the key there and
checks it is a boolean elsewhere.
- Entries that already point at a system with false are dropped after
the config is loaded and after every SIGHUP reload (SUB_MAP is persisted).
- Docs: configuration.md and private-calls.md (en/es); the example ECHO
sets it explicitly.
Closes#109
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
- process_acls built every system's TG1_ACL from TGID_TS1_ACL (or
PERMIT:ALL), so TGID_ACL was never applied on an OpenBridge, in either
direction; the normalizer's copy never ran because TG1_ACL already existed.
- OpenBridge takes TG1_ACL from TGID_ACL, as in FreeDMR; MASTER/PEER keep
their slot ACLs.
The lists were downloaded once STALE_DAYS old, whatever the server had
published since: a DMR ID issued today could be refused at login on masters
with ALLOW_UNREG_ID: false for up to a day, and the unchanged 44MB subscriber
list was fetched again every day.
- The checksum file (a few hundred bytes) is fetched on every tick, and a
list is downloaded only when its published checksum no longer matches the
file on disk. Without a checksum file, STALE_DAYS decides as before.
- A published checksum the download never matches is retried once an hour,
not every tick, until the server publishes a different one.
- The file digest is cached against its stamp, so verifying an unchanged
44MB file costs nothing on each tick.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
Talker-alias buffers (_dmra_by_stream, _ta_voice_acc, _ta_complete), the
passthrough relay dedupe set and log-once ingress keys are only released on
the HBP VTERM hook. OPENBRIDGE streams never hit it, and the OBP branch of
stream_trimmer_loop returned before trim_dmra_streams(), so every stream seen
on an OBP left one entry per structure behind (~38k after 35 h on a live
master, ~2 KB per call).
- On stage-2 removal of an OBP stream, call clear_talker_alias_stream() and
drop the stream's log-once ingress keys.
- Run trim_dmra_streams() for OBP protocols too (catches buffers keyed by
streams that never got a STATUS row).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnjAx7G27d9q88j9PFLj11
HBP->OBP forward legs (to_target rows with H_LC) only became eligible for
removal when flagged _end_tx_sent/_bcsq_quenched. The VTERM path emitted
END,TX without setting the flag, so one row per forwarded call and per OBP
stayed in STATUS forever (~3 KB/call measured; ~30-40 MB/day on a live master).
- VTERM on a forward leg now sets _end_tx_sent.
- The stream trimmer marks any idle forward leg _to, so it is removed after
180 s even if VTERM never arrived.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vz1o2mo7r43iNnpD2MQRLA
- Parse the subscriber file once per reload, turning each record into a
profile as the decoder finishes it, instead of parsing it twice and
building the whole object tree first.
- Profiles are plain tuples with interned names: a dict each doubled the
memory, and a NamedTuple stays tracked by the garbage collector.
- One copy of subscriber_ids, and the default local subscriber file (the
subscriber file itself) is not parsed again.
As soon as any plugin was loaded, every voice frame built a full
CallLegContext and event (~13 us) and scheduled its own callLater
(~2-7 us), even for plugins that never look at voice.
- A plugin may declare `events` (the event classes it handles). The bus
keeps the union and `wants()` / `wants_any()`; the voice and data
bridges check it before building anything, and emit() only calls
plugins that take that event. Undeclared plugins and internal
handlers still get everything.
- emit_deferred batches: one call_later per reactor tick, same order.
- The group context's per-stream constant part (IDs, mode, proxy flag,
aliases) is resolved once per stream; each event still gets its own
`extra` dict.
- Fix: _plugin_started / _plugin_ended grew by one entry per call
forever; END now drops the START key and ended keys are capped.
Per voice frame, group voice to 6 OBP + a MASTER (48 us with no plugin):
any plugin 66.0 -> 59.4 us; a data-only plugin 49.4 us.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found on ADN 2131: a MASTER added to adn-server.yaml and loaded with
SIGHUP logged "added system ... listening" but answered no login.
reload_server_config builds the new systems into the config it is
reloading, which the server swaps in only at the end; create_protocol(name)
built the protocol from the live config, where the system was not there
yet. HBPProtocol copied an empty system block: no MODE, so none of the
MASTER state was set up and every packet was ignored. Systems that already
existed are fine: they get apply_system_config(<reloaded config>).
create_protocol now receives the config being reloaded, and
peer_server._create_hbp_protocol builds from it (startup is unchanged).
Regression test with the real HBPProtocol wired as the server wires it
(ConfigProxy, prepare_reload_config, swap): the added MASTER has its MODE
and answers RPTL with RPTACK. It fails without the fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found on a live master (2131): a plugin beacon on TG 213 reached the
OpenBridges with 2 frames out of 115. PluginIngress marked the ingress
MASTER slot as TX of the stream, while its RX fields still held the last
radio's call. From the second frame on, group_voice_tg_ingress_collision
saw TG 213 active on that slot (our own TX mark) with a stream and a
source that were not ours (the stale RX ones), took it for a QSO and
suppressed the uplink: only the MASTER's own hotspots heard the rest.
A hotspot frame doesn't have this: udp_hbp records the slot's RX state
(RX_STREAM_ID, RX_LC, RX_RFS, RX_TGID, RX_TYPE, RX_TIME…) once routing
accepts it, so the next frame is the same stream, not a new one.
PluginIngress now does exactly that instead of the TX mark. The slot
still reads busy for routed voice while the stream plays (its RX leg),
a radio or another stream still makes the next frame fail, and the
terminator or the 1 s silence sweep sets RX_TYPE back to VTERM.
Regression test: stale RX state on the slot, a whole beacon forwarded,
header and embedded LC both the beacon's (the LC itself was never
affected: routing builds each leg's LC from the target TG and rf_src).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They are now the voice-announcements plugin (previous commit). Removed
from the core:
- VoiceUseCases: scheduled_announcement, scheduled_tts_announcement, the
broadcast queue, target and slot selection, slot marking, legacy
monitor reports and apply_voice_config (~900 lines). What stays:
voice ident, on-demand 999x files and the disconnected prompt, which
answer a radio rather than follow a schedule.
- inject_announcement_ptt and its bootstrap wiring; plugin frames enter
through inject_plugin_dmrd.
- The TTS engine moves into the plugin (plugin/infrastructure), with its
tests; VoiceProvider.ensure_tts_ambe is gone; tts_ambe.py was a dead
stub.
Nothing to change for sysops:
- the plugin is versioned and enabled by default, and still reads
VOICE.ANNOUNCEMENTS / TTS_ANNOUNCEMENTS from adn-voice.yaml;
- without a PLUGINS.send entry the server grants voice-announcements
exactly the TGs and DMR IDs those items use (disabled ones included,
so enabling one needs no restart); an explicit entry wins;
- the manager now always hands voice_slot_for_tg with send_dmrd; both
check the talkgroup grant on every call.
Tests: the announcement tests of the core are replaced by the plugin's
(schedule, per-TG queue, busy slots, QSO cut, hourly, TTS and its
failures, default DMR ID, derived grant) and by routing tests of plugin
voice ported from test_announcement_ptt_inject (OBP fan-out, no
misattribution to a real peer, dynamic/bridged slot choice, no
pre-armed bridge needed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scheduled announcements and TTS announcements of VoiceUseCases, as
an official plugin that speaks through send_dmrd. Same configuration
(VOICE.ANNOUNCEMENTS / TTS_ANNOUNCEMENTS in adn-voice.yaml, followed
every 15 s) and the same behaviour: interval or hourly, one playback
per TG at a time 1.5 s apart, retries while the TG or every slot is
busy, 58 ms per frame, stop on a refused frame, TTS encoded in a
thread. Versioned next to plugins/example.
Core side, found by an end-to-end run of the plugin:
- PluginIngress ends a plugin voice stream that has been silent for a
second without a terminator (frees the slot, monitor END);
- the default max_frames_per_s adds 18 frames/s per group voice TG, so
one stream per TG fits (a voice stream is ~17 frames/s).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What a voice plugin needs from the core that it can't see itself:
- ServerContext.voice_slot_for_tg(tg): the MASTER slot to speak a TG on
now, or None while every slot is busy. Same choice announcements make
today (dynamic UA session or active bridge leg of the TG on that
MASTER first, then TS2, then TS1), ported to PluginIngress so the
announcement code can leave the core. Only for granted talkgroups.
- PluginIngress reports GROUP VOICE START/END,TX on the MASTER a plugin
stream plays on, the line announcements send today: its hotspots hear
the stream but no bridge leg reports it. A stream cut by a radio, or
never terminated, still gets its END.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #104: master_kill and revoking PLUGINS.send did not take
effect on SIGHUP, because merge_top_level_config never re-read PLUGINS.
Going through the real path showed it goes further: YamlConfigLoader
builds the config from a fixed list of sections and dropped PLUGINS
altogether, so the documented block (directory, master_kill, overrides)
was never read, at startup either. Both predate this PR.
- YamlConfigLoader keeps PLUGINS when present (like OBP_PROXY).
- merge_top_level_config replaces PLUGINS on every reload, absent
included: removing the block removes everything in it.
- Tests through prepare_reload_config + merge_top_level_config +
swap_runtime_config and a ConfigProxy, as the server wires them:
entry removed, master_kill, whole section removed, a TG granted; and
one with the real loader on a real adn-server.yaml, boot and reload.
Also from the review:
- parse_dmrd_header uses call_attributes(); PluginIngress uses
server_id_bytes().
- A max_frames_per_s that is not a finite positive number grants nothing.
- The allowlist is documented as a guard against buggy plugins, not a
sandbox: a plugin runs in-process with the live config.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Extract a voice burst's embedded LC from the 5 bytes that hold it
instead of running the full voice() decode.
- Once a stream's alias has decoded, later bursts only refresh its
expiry instead of reassembling it again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First step to move scheduled announcements, TTS and voice beacons out of
the core into a plugin: a plugin granted `group_voice_tgs` in
PLUGINS.send can send group voice on those talkgroups.
- PluginIngress (application layer) enters plugin frames on the
announcement MASTER. Group voice goes through dmrd_received with
synthetic_announcement=True, exactly the path announcements use (the
TG's bridges, OpenBridge included), then to that MASTER's hotspots.
- While a plugin stream plays it holds the MASTER slot (TX_TYPE=VHEAD,
TX_STREAM_ID, TX_RFS, TX_TGID), so routed voice finds it busy; a radio
or another stream on the slot fails the frame; VTERM frees it.
- send_dmrd called on the reactor thread returns the routing result, so
a plugin knows when to stop; from a worker thread it is queued.
- Private voice stays refused. Unit data is unchanged (local only).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ServerContext.send_dmrd(pkt) hands one DMRD frame to the routing core,
through the same synthetic ingress path scheduled announcements use
(inject_plugin_dmrd -> dmrd_received on the announcement MASTER, with
the SERVER_ID as peer). Only plugins listed in PLUGINS.send get it.
Guards (PluginDmrdSender, re-read from the live config on every frame):
- allowed_src_ids: a plugin can't send as a radio; required.
- max_frames_per_s: per-plugin token bucket, starts full.
- unit data only in this version (data header, rate 1/2, 3/4, CSBK).
- master_kill or removing the entry stops sending at once.
Routing of plugin frames (dmrd_received plugin_origin):
- delivered by the unit data path only: SUB_MAP / hotspot peer ID, to
the destination's exact hotspot, also on the ingress MASTER itself;
- never through the private call path, which would learn the plugin's
source in SUB_MAP (spreading replies over every hotspot of that
MASTER) and keep call state on its shared slot;
- no OpenBridge or DATA-GATEWAY fan-out;
- plugin events for them carry is_synthetic=True.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The state a prompt shares between its thread and the reactor is a
small dataclass (_PromptRun) instead of a dict with string keys.
- "Is the slot held by another stream?" now lives in routing/helpers.py
next to slot_has_active_voice, and both read the RX/TX legs through
one helper, instead of a third copy of that check in voice_use_cases.
- Blank lines and the test header follow the rest of the repo.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Voice ident, the 9991-9999 on-demand files and the disconnected prompt
run on a worker thread and sent every frame through send_voice_packet,
which refreshes TX_TIME but never TX_TYPE. The slot stayed at VTERM for
the whole prompt, so routing saw it free: on a system with
GROUP_HANGTIME 0 routed group voice went out as a second stream on the
same slot, and a radio keying up did not stop the prompt either.
Scheduled and TTS broadcasts already get this right. The three prompts
now share play_on_slot: the thread only paces the frames, and each one
is sent on the reactor, which marks the slot the way broadcasts do
(TX_TYPE=VHEAD, TX_STREAM_ID, TX_RFS), stops the prompt when a radio is
talking or another stream holds the slot, and frees it at the end if
the prompt still holds it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- State the invariant the plan cache relies on: from a SYSTEMS block the
plan reads only MODE, which only a reload changes, so block identity is
enough; anything else it reads must join the cache key.
- Build the plan's ingress with only what resolve() routes on, instead of
passing empty peer, radio and stream ids through _voice_forward_plan.
- SubscriptionStore.has_table is abstract; the scan default is gone.
- Both caches are created in RoutingUseCases.__init__, and a full cache
drops its oldest entry instead of all of them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A new forward leg gets its header, terminator and embedded LC encoded
(BPTC 196,96 + RS, about 250us). Every leg of a call to the same TG gets
the same LC, so a call bridged to six OpenBridges and a MASTER spent
1.75ms on its first frame doing the same work seven times. The encoded
set is now kept per LC (bounded) and shared by the legs, which only ever
slice it.
- In-band signalling runs on each voice header and terminator and walked
every subscription of the server to find those of the source system. The
store now indexes legs by system, in the order a full scan returns them.
- The remaining full scans used to test or drop a relay table, and the copy
of a whole table just to test it is not empty, use the table index.
Short calls (50 frames), one call bridged to 6 OpenBridges and a MASTER,
200 other bridged TGs in the store, per frame, after the previous commit:
HBP ingress 136.4us -> 97.9us
OBP ingress 98.1us -> 60.7us
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every group voice frame, from HBP or OpenBridge, asked store_has_table()
whether its TG has a relay table. It answered by building a tuple of every
subscription and calling table_key() on each, so the cost of a frame grew
with the size of the network. On a live master (ADN 213, six OpenBridges)
this was 26% of the CPU spent on OpenBridge ingress.
- has_table() on the store answers from the table index it already keeps;
the port gets a default that scans, for stores without one.
- The forward plan of a group call (relay tables, resolved legs, the
MASTER/PEER dedupe and the target entries) depends only on the store and
on the source and target SYSTEMS blocks. It is now kept per
(system, slot, TG) and rebuilt when the store's new revision counter moves
or a reload replaces one of those blocks. ENABLED, quench, keepalive and
contention are still checked per frame in the loop.
- One OBP session lookup per target instead of two.
- store_has_table is imported once, not on every frame.
Per frame, one call bridged to 6 OpenBridges and a MASTER, with N other
bridged TGs in the store:
N=0 N=200
HBP ingress 81.8us -> 52.1us 447.4us -> 55.3us
OBP ingress 95.9us -> 66.8us 469.3us -> 65.7us
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow the .tmp.{pid}.{thread} convention of alias_loader.py plus a
per-process counter: the SIGHUP handler runs on the main thread, the same
one the trimmer saves from, so pid and thread alone could still collide.
A failed pickle.dump no longer leaves an orphan temp file behind.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It runs once per datagram, for OBP and local traffic alike, and built a tuple
of every subscription to answer a yes/no question. Profiling a production
server at 198 datagrams/s put 67.8% of all CPU work inside it.
legs_in_table already reads the _by_table index and is on the port. Both were
added in the same commit as the scan, which never used them.
Constant time now instead of growing with the mesh: 6.8us to 0.30us at 120
subscriptions, 26.2us to 0.29us at 2400. On the server, 67.8% of work down to
0.84% and 42% less CPU at equal load.
Rule timers, in-band signalling and resets change a subscription in place
(sub.state.phase = IDLE) and then upsert the same object. upsert unindexed
"the old one" by reading its state, but the old one is that same object, now
IDLE, so the active indexes were never cleared: relay_tables_with_active_source
kept listing the leg as an active source and has_active_target_leg stayed true.
The visible effect: when a timed-out rule deactivates a hotspot's leg in the
middle of a call, the rest of the call is still forwarded, where the legacy
router checked ACTIVE on the source row for every frame and stopped. The
downlink hang logic also kept treating the system as having that leg.
The store now records what it indexed each leg under and removes exactly
that. Tests cover a leg deactivated in place, one activated in place next to
another active leg on the same key, a remove after an in-place change, and
the timed-out source end to end. All four fail on develop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SUB_MAP was written once an hour. The shutdown save only runs if SIGTERM
reaches the server, which it does not under a Docker entrypoint that stays
PID 1, so a restart dropped up to an hour of routes. Private calls to those
units then go nowhere (FORWARD: []) until each radio transmits again.
The loop now ticks every 300s and writes only when a route (system, slot,
peer) changed or an entry's timestamp moved to a new hour, so the 24h trim
still sees fresh times after a restart. An idle master does not write at all.
The pickle is written to a .tmp and renamed. A crash mid-dump used to leave a
truncated file, which load() reads as an empty map.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
_master_datagram_received and _peer_datagram_received each carried the same
32 lines: global SUB_ACL, the TG list for the frame's slot, then the system's
own three, every rejection logging once per stream through _laststrid. The two
copies were identical down to the wording of the six log messages, so a fix in
one could silently miss the other.
They now call _acl_rejects_dmrd, which keeps the legacy order, the same
messages and the same once-per-stream guard, and reads the TG list as
TG{slot}_ACL instead of spelling out slot 1 and slot 2. The frame's slot is
always 1 or 2 (it comes from bit 0x80), so no branch is lost.
tests/hbp/test_acl_gate.py covers both paths, the per-slot TG list and the
on-demand unit-service exemption; three of its four tests pass unchanged
against the previous code.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>