Skip to content

Reprocess repeated packets and deduplicate logic#8216

Merged
thebentern merged 3 commits into
meshtastic:developfrom
GUVWAF:reprocessPacket
Oct 5, 2025
Merged

Reprocess repeated packets and deduplicate logic#8216
thebentern merged 3 commits into
meshtastic:developfrom
GUVWAF:reprocessPacket

Conversation

@GUVWAF

@GUVWAF GUVWAF commented Oct 5, 2025

Copy link
Copy Markdown
Member

This unifies the logic for upgraded packets and rebroadcasting to avoid duplication.

@h3lix1 I created a new perhapsHandleUpgradedPacket() method. Instead of setting wasSeenRecently again when we did not remove the pending Tx packet, I just removed the wasSeenRecently = false from the PacketHistory, as we don't need it, because we would already return before that is checked.

Originally NextHopRouter had a perhapsRelay() method that was almost the same as perhapsRebroadcast(), except that it needed to check whether the next-hop was set to us. Since for the FloodingRouter in this case it's NO_NEXT_HOP_PREFERENCE, we can use the same logic, so in FloodingRouter its now a pure virtual function. Then when sending, it either calls FloodingRouter::send() or NextHopRouter::send().

Furthermore, with this, we apply the "reprocessing" logic also to repeated packets (when the same node retransmits), in order to update the traceroute result also. Currently, this would result in "unknown" nodes (0xffffff).

@GUVWAF GUVWAF requested a review from thebentern October 5, 2025 12:16
@GUVWAF GUVWAF added the enhancement New feature or request label Oct 5, 2025
@thebentern thebentern requested a review from Copilot October 5, 2025 13:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the packet routing logic to unify the handling of upgraded packets and rebroadcasting between FloodingRouter and NextHopRouter, eliminating code duplication while extending reprocessing logic to repeated packets for improved traceroute functionality.

  • Consolidates duplicate packet upgrade handling logic into shared methods
  • Refactors NextHopRouter to use the same rebroadcasting interface as FloodingRouter
  • Extends packet reprocessing to repeated packets to fix traceroute "unknown" node issues

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/mesh/PacketHistory.cpp Removes unnecessary seenRecently = false assignment for upgraded packets
src/mesh/NextHopRouter.h Changes method signature from perhapsRelay() to perhapsRebroadcast() with override
src/mesh/NextHopRouter.cpp Refactors packet handling to use shared upgrade logic and adds reprocessing for repeated packets
src/mesh/FloodingRouter.h Makes perhapsRebroadcast() pure virtual and adds new shared methods for packet handling
src/mesh/FloodingRouter.cpp Extracts shared upgrade handling logic and removes duplicate rebroadcast implementation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/mesh/FloodingRouter.cpp
Comment thread src/mesh/NextHopRouter.cpp Outdated
@thebentern thebentern merged commit 27f316b into meshtastic:develop Oct 5, 2025
70 checks passed
@GUVWAF GUVWAF deleted the reprocessPacket branch November 2, 2025 13:31
jeek pushed a commit to jeek/Meshtastic-Exploiteers-Hacker-Pager that referenced this pull request Jun 30, 2026
Reprocess repeated packets and deduplicate logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants