diff --git a/src/mesh/NextHopRouter.cpp b/src/mesh/NextHopRouter.cpp index 0c60d2cd3..689435115 100644 --- a/src/mesh/NextHopRouter.cpp +++ b/src/mesh/NextHopRouter.cpp @@ -18,7 +18,7 @@ ErrorCode NextHopRouter::send(meshtastic_MeshPacket *p) wasSeenRecently(p); // FIXME, move this to a sniffSent method p->next_hop = getNextHop(p->to, p->relay_node); // set the next hop - LOG_DEBUG("Setting next hop for packet with dest %x to %x", p->to, p->next_hop); + // LOG_DEBUG("Setting next hop for packet with dest %x to %x", p->to, p->next_hop); // If it's from us, ReliableRouter already handles retransmissions. If a next hop is set and hop limit is not 0, start // retransmissions @@ -102,7 +102,7 @@ uint8_t NextHopRouter::getNextHop(NodeNum to, uint8_t relay_node) if (node) { // We are careful not to return the relay node as the next hop if (node->next_hop && node->next_hop != relay_node) { - LOG_DEBUG("Next hop for 0x%x is 0x%x", to, node->next_hop); + // LOG_DEBUG("Next hop for 0x%x is 0x%x", to, node->next_hop); return node->next_hop; } else { if (node->next_hop) @@ -152,10 +152,10 @@ bool NextHopRouter::stopRetransmission(GlobalPacketId key) /** * Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting. */ -PendingPacket *NextHopRouter::startRetransmission(meshtastic_MeshPacket *p) +PendingPacket *NextHopRouter::startRetransmission(meshtastic_MeshPacket *p, uint8_t numReTx) { auto id = GlobalPacketId(p); - auto rec = PendingPacket(p, this->NUM_RETRANSMISSIONS); + auto rec = PendingPacket(p, numReTx); stopRetransmission(getFrom(p), p->id); @@ -203,7 +203,7 @@ int32_t NextHopRouter::doRetransmissions() // Also reset it in the nodeDB meshtastic_NodeInfoLite *sentTo = nodeDB->getMeshNode(p.packet->to); if (sentTo) { - LOG_WARN("Resetting next hop for packet with dest 0x%x\n", p.packet->to); + LOG_INFO("Resetting next hop for packet with dest 0x%x\n", p.packet->to); sentTo->next_hop = NO_NEXT_HOP_PREFERENCE; } FloodingRouter::send(packetPool.allocCopy(*p.packet)); diff --git a/src/mesh/NextHopRouter.h b/src/mesh/NextHopRouter.h index 07185f088..376182e6e 100644 --- a/src/mesh/NextHopRouter.h +++ b/src/mesh/NextHopRouter.h @@ -76,10 +76,12 @@ class NextHopRouter : public FloodingRouter virtual int32_t runOnce() override { // Note: We must doRetransmissions FIRST, because it might queue up work for the base class runOnce implementation - auto d = doRetransmissions(); + doRetransmissions(); int32_t r = FloodingRouter::runOnce(); + // Also after calling runOnce there might be new packets to retransmit + auto d = doRetransmissions(); return min(d, r); } @@ -113,7 +115,7 @@ class NextHopRouter : public FloodingRouter /** * Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting. */ - PendingPacket *startRetransmission(meshtastic_MeshPacket *p); + PendingPacket *startRetransmission(meshtastic_MeshPacket *p, uint8_t numReTx = NUM_RETRANSMISSIONS); /** * Stop any retransmissions we are doing of the specified node/packet ID pair diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index ca6a199fc..0d052f482 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -23,7 +23,7 @@ ErrorCode ReliableRouter::send(meshtastic_MeshPacket *p) } auto copy = packetPool.allocCopy(*p); - startRetransmission(copy); + startRetransmission(copy, this->NUM_RETRANSMISSIONS); } /* If we have pending retransmissions, add the airtime of this packet to it, because during that time we cannot receive an