Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ACK logic for responses and repeated packets #5232

Merged
merged 4 commits into from
Nov 3, 2024

Conversation

GUVWAF
Copy link
Member

@GUVWAF GUVWAF commented Nov 3, 2024

Responses to packets sent with want_ack will also use want_ack:

p->want_ack = (to.from != 0) ? to.want_ack : false;

A consequence of this is that we were also sending a real ACK (over multiple hops) again when receiving a response, which is unnecessary as the responder doesn't do anything with it. It only needs to stop retransmissions, which it does when receiving an implicit ACK already. Only if receiving it directly (so nobody created an implicit ACK yet), we have to send an ACK with hop limit of 0. I had to rewrite the hop limit logic for sendAckNak() to do this.

Next, there was logic to rebroadcast again in case a node was retransmitting a reliable packet, e.g., because the ACK got lost, but I found it would immediately cancel it again when it was checking for wasSeenRecently() afterwards. Now with 0c763af, we do as if the packet was not yet received if we hear the original transmitter repeating it.

Lastly, I added an exception to ignoring duplicate packets from the PhoneAPI when using the simulator.

@GUVWAF GUVWAF requested a review from thebentern November 3, 2024 10:41
@thebentern thebentern merged commit da7424a into meshtastic:master Nov 3, 2024
47 checks passed
caveman99 pushed a commit that referenced this pull request Nov 3, 2024
* Don't send ACKs to responses over multiple hops

* Move repeated sending logic to `wasSeenRecently()`

* Add exception for simulator for duplicate packets from PhoneAPI

* Add short debug message
@GUVWAF GUVWAF deleted the ackImprv branch November 6, 2024 07:49
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.

2 participants