fix(peer): heartbeat MsgPeerTgInterest re-sends to keep TTL alive

The 60 s heartbeat path was inheriting the skip-when-unchanged gate
from the 500 ms debounce path. Result: after the initial
edge-triggered advertisement, an idle reflector with a stable monitor
list would silently no-op every 60 s, the receiver's
m_peer_interested_tgs[tg] timestamp never got refreshed, and its
600 s TTL elapsed. A passive monitor would go deaf 10 minutes after
adding a foreign TG to monitoredTGs.

Split the two call sites: heartbeat passes force=true (always send),
debounce keeps force=false (skip when unchanged). The steady-state
heartbeat is one frame per trunk per minute, which is what the
receiver TTL needs.

Doc note in PEER_PROTOCOL.md was wrong (claimed both timers skipped
unchanged sends); corrected.

Affects v1.3.9; ship as v1.3.10.
This commit is contained in:
Audric authored and Audric IW1GEU committed 2026-05-08 21:03:41 +02:00
1 parent a6618790bb
commit e9bb1a9e2d
3 files changed
+25 -12

No files matched your search

+8 -4
View File
@@ -276,10 +276,14 @@ Send cadence:
- **Edge-triggered** on local-state changes that affect the set: client
connect / disconnect, `MsgSelectTG`, `MsgTgMonitor`, and trunk hello
completion. Coalesced with a 500 ms debounce so a client toggling its
monitor list one TG at a time sends one update, not many.
- **Periodic refresh** every 60 s as a safety net against lost deltas.
Both timers skip the actual send when the outgoing set is unchanged
since the last transmission, so an idle reflector generates no traffic.
monitor list one TG at a time sends one update, not many. This path
skips the actual send when the outgoing set is unchanged.
- **Periodic refresh** every 60 s — *always sends*, even when the
outgoing set is unchanged. The heartbeat is what keeps the receiver's
`m_peer_interested_tgs` entries from expiring at the 600 s TTL: every
receipt rewrites the timestamp, so an idle monitor stays known to its
peer indefinitely. Without this the monitor would go deaf 10 minutes
after the last edge-triggered change.
Multi-hop propagation: when a reflector receives `MsgPeerTgInterest` from
a peer P, it triggers a refresh on its other trunk links. Each other