ACK retried want_ack packets

This commit is contained in:
Ryan Tolboom
2021-11-22 21:31:12 -05:00
parent bc7fc1285d
commit c36b233c49
5 changed files with 16 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ ErrorCode ReliableRouter::send(MeshPacket *p)
return FloodingRouter::send(p);
}
bool ReliableRouter::shouldFilterReceived(const MeshPacket *p)
bool ReliableRouter::shouldFilterReceived(MeshPacket *p)
{
// Note: do not use getFrom() here, because we want to ignore messages sent from phone
if (p->to == NODENUM_BROADCAST && p->from == getNodeNum()) {
@@ -54,6 +54,17 @@ bool ReliableRouter::shouldFilterReceived(const MeshPacket *p)
}
}
/* send acks for repeated packets that want acks and are destined for us
* this way if an ACK is dropped and a packet is resent we'll ACK the resent packet
* make sure wasSeenRecently _doesn't_ update
* finding the channel requires decoding the packet. */
if (p->want_ack && (p->to == getNodeNum()) && wasSeenRecently(p, false)) {
if (perhapsDecode(p)) {
sendAckNak(Routing_Error_NONE, getFrom(p), p->id, p->channel);
DEBUG_MSG("acking a repeated want_ack packet\n");
}
}
return FloodingRouter::shouldFilterReceived(p);
}