Repository navigation
Cancel queued TRACE resends when the downstream forward is overheard - #25
Kernel-Error wants to merge 1 commit into
Conversation
…heard The per-hop resend cancel in onRecvPacket() sits after the TRACE branch, which always returns, so a TRACE resend was never cancelled and went out even when the next hop had already forwarded the packet. Measured on a busy repeater: ~40 redundant TRACE retransmissions per 30 min.
|
@Kernel-Error #25: Confirmed. The TRACE branch at the top of Mesh::onRecvPacket() always returns, so the generic resend-cancel block further down is never reached for TRACE, and every mid-path forward of a TRACE is re-sent up to max.resend times. Your fix reuses isRetryMatch(), skips the terminal leg and still processes the received packet normally. Looks correct to me. Both apply cleanly together on top of my meshcore-dev#2670 port and build for Heltec V3 (repeater, room server, companion BLE) and RAK4631 (repeater). One organisational note: mups18 is regenerated by my build script and force-pushed on every release, so a merge into mups18 would be lost on the next rebuild. I’ll cherry-pick both commits (your authorship is kept) into the branch that carries the meshcore-dev#2670 port and close the PRs with a reference to the commits. They will be in the next mups release. Both issues come from upstream PR meshcore-dev#2670 itself (the code is the same there), so I’ll report them there as well and point to your commits. About the noise floor sitting at −120 dBm on the Heltec: my port deliberately leaves out the noise-floor median estimator of meshcore-dev#2670 (it conflicts with RX power saving), so this may be specific to my firmware. If you can reproduce it, please open a separate issue with the board, firmware version and how you observed it. |
|
Cherry-picked into mu/pr-2670-ps18 as 75311e7 (authorship kept). It will be part of the next mups release. Thanks! |
…ast-hop TRACE Two TRACE issues in the resend logic, found by Sebastian van de Meer (Kernel-Error) and reviewed/measured by m0urs on a live repeater (m0urs#25, m0urs#26): 1. Queued resends of TRACE forwards were never cancelled: the TRACE branch in Mesh::onRecvPacket() always returns, so the generic echo-cancel block further down was never reached for TRACE. Each intermediate hop re-sent every TRACE up to max_resend_attempts times even though the next hop had already forwarded it (~40 redundant transmissions per 30 min on a busy repeater). The TRACE branch now scans the outbound queue for a matching queued TRACE resend (isRetryMatch) and removes it, for well-formed non-terminal legs, before normal TRACE processing. 2. The last-hop TRACE forward pre-set sending_attempts = max to suppress retries, which made the first (and only) send look like a resend: it went through the resend LBT gate instead of the normal channel check and was counted in the resend statistics. Replaced by a runtime-only no_retry flag on Packet (reset in the ctor and in the pool free()), checked first in resendPacket(). The packet is sent once like any other first send and never resent. Co-Authored-By: Claude Code <noreply@anthropic.com>
The resend cancel in Mesh::onRecvPacket() (from the meshcore-dev#2670 port) sits after the TRACE branch. That branch always returns, so a
queued TRACE resend is never cancelled and goes out even when the next hop already forwarded the trace.
This adds the same cancel inside the TRACE branch: if a direct TRACE comes in whose SNR list starts with one of our queued TRACE
resends (Packet::isRetryMatch, which already handles the TRACE case) the queued resend is removed. Only for well formed TRACE
(plain SNR count, whole route entries) and only for non terminal legs,
outboundis not touched.Measured on DE-NW-SU-Todenfeld-KE (Heltec V4, Mesh Rheinland, busy channel) as a runtime toggle in a debug build, 8 randomized
30 min A/B blocks with TRACE round trips from a companion: 22-27 cancels per block, ~40 redundant TRACE retransmissions saved per
30 min. Delivery did not change measurably: 1 hop path ok 73.9 vs 70.6 % (p=0.46). On a 3 hop path it was 59.1 vs 65.0 % (p=0.20),
not significant but I want to mention it, more data welcome.
Built for heltec_v4_repeater on mups18 1194b08. Developed with AI assistance, reviewed and tested by me on the live repeater.