From 3d45c4dbd8fefb2bc21edb2cd330418f048a8760 Mon Sep 17 00:00:00 2001 From: GUVWAF <78759985+GUVWAF@users.noreply.github.com> Date: Sat, 8 Oct 2022 14:27:59 +0200 Subject: [PATCH] Don't resend ACK if another module sent a response (#1772) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * strcmp returns zero if strings are equal * Make debug message more clear * Don't resend ACK if another module sent a response Co-authored-by: Ben Meadors Co-authored-by: Thomas Göttgens --- src/mesh/ReliableRouter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index 93410bc9f..f77e2a455 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -58,12 +58,12 @@ bool ReliableRouter::shouldFilterReceived(MeshPacket *p) * 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 (p->want_ack && (p->to == getNodeNum()) && wasSeenRecently(p, false) && !MeshModule::currentReply) { if (perhapsDecode(p)) { sendAckNak(Routing_Error_NONE, getFrom(p), p->id, p->channel); DEBUG_MSG("acking a repeated want_ack packet\n"); } - } else if (wasSeenRecently(p, false) && p->hop_limit == HOP_RELIABLE) { + } else if (wasSeenRecently(p, false) && p->hop_limit == HOP_RELIABLE && !MeshModule::currentReply) { // retransmission on broadcast has hop_limit still equal to HOP_RELIABLE DEBUG_MSG("Resending implicit ack for a repeated floodmsg\n"); MeshPacket *tosend = packetPool.allocCopy(*p); @@ -94,7 +94,7 @@ void ReliableRouter::sniffReceived(const MeshPacket *p, const Routing *c) // - not DSR routing) if (p->want_ack) { if (MeshModule::currentReply) - DEBUG_MSG("Someone else has replied to this message, no need for a 2nd ack\n"); + DEBUG_MSG("Some other module has replied to this message, no need for a 2nd ack\n"); else sendAckNak(Routing_Error_NONE, getFrom(p), p->id, p->channel); }