Skip to content

Early receives: allow nodes to process most incoming direct packets ASAP#2651

Open
redxdev wants to merge 1 commit into
meshcore-dev:devfrom
redxdev:redxdev/early-receive
Open

Early receives: allow nodes to process most incoming direct packets ASAP#2651
redxdev wants to merge 1 commit into
meshcore-dev:devfrom
redxdev:redxdev/early-receive

Conversation

@redxdev
Copy link
Copy Markdown

@redxdev redxdev commented May 31, 2026

Right now a node can only process a direct packet if it is receiving the final hop (i.e. the entire path has been consumed), but this seems like it is unnecessary for payload types that are easy to check destination hashes on.

For example, consider a packet with path A,B,C with a destination of D. If node D can hear A directly, there's no reason for it to wait for C to repeat the packet before replying.

There was already an exception for ACKs that worked this way, so this change extends that to a few other payload types that all have easy access to the destination hash.

…been consumed) if they think they are the destination
Comment thread src/Mesh.cpp
onAckRecv(pkt, ack_crc);
}
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Just noting that this is a slight behavior change, and opens up one weird edge case: if a packet has the local node as part of the path and as the destination (i.e. the full path is something like A,B,C with a destination of B) then the packet won't be received early as retransmit logic takes priority here. I could restructure the code to avoid this situation, but it's a bit nonsensical in the first place and I'm not sure it's worth fixing.

@redxdev
Copy link
Copy Markdown
Author

redxdev commented May 31, 2026

Also noting a potential downside of this change: this will result in a node processing more packets in total, since it will now process any direct packet with a destination that has the same 1-byte hash as itself. Previously this would be somewhat protected against since it would only process a packet with a colliding destination hash if it could hear the final hop in the path.

That said, I don't think this is a big deal - flood messages end up having to be processed the same way already where a node can't tell if it is intended as the destination until it attempts to decrypt the payload, so this seems like it should be fine.

@redxdev redxdev marked this pull request as ready for review May 31, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant