Also when want_ack is set, we should try to retransmit

This commit is contained in:
GUVWAF 2024-11-08 21:42:54 +01:00
parent 78bf1e192b
commit f37abe8f0f
2 changed files with 6 additions and 6 deletions

View File

@ -20,9 +20,9 @@ ErrorCode NextHopRouter::send(meshtastic_MeshPacket *p)
p->next_hop = getNextHop(p->to, p->relay_node); // set the next hop 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 // If it's from us, ReliableRouter already handles retransmissions. If a next hop is set and hop limit is not 0 or want_ack is
// retransmissions // set, start retransmissions
if (!isFromUs(p) && p->next_hop != NO_NEXT_HOP_PREFERENCE && p->hop_limit > 0) if (!isFromUs(p) && p->next_hop != NO_NEXT_HOP_PREFERENCE && (p->hop_limit > 0 || p->want_ack))
startRetransmission(packetPool.allocCopy(*p)); // start retransmission for relayed packet startRetransmission(packetPool.allocCopy(*p)); // start retransmission for relayed packet
return Router::send(p); return Router::send(p);

View File

@ -29,7 +29,7 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd
r.rxTimeMsec = millis(); r.rxTimeMsec = millis();
r.next_hop = p->next_hop; r.next_hop = p->next_hop;
r.relayed_by[0] = p->relay_node; r.relayed_by[0] = p->relay_node;
LOG_INFO("Add relayed_by 0x%x for id=0x%x", p->relay_node, r.id); // LOG_INFO("Add relayed_by 0x%x for id=0x%x", p->relay_node, r.id);
auto found = recentPackets.find(r); auto found = recentPackets.find(r);
bool seenRecently = (found != recentPackets.end()); // found not equal to .end() means packet was seen recently bool seenRecently = (found != recentPackets.end()); // found not equal to .end() means packet was seen recently
@ -56,7 +56,7 @@ bool PacketHistory::wasSeenRecently(const meshtastic_MeshPacket *p, bool withUpd
if (found->sender != nodeDB->getNodeNum() && found->next_hop != NO_NEXT_HOP_PREFERENCE && if (found->sender != nodeDB->getNodeNum() && found->next_hop != NO_NEXT_HOP_PREFERENCE &&
p->next_hop == NO_NEXT_HOP_PREFERENCE && found->next_hop != ourRelayID && p->relay_node != 0 && p->next_hop == NO_NEXT_HOP_PREFERENCE && found->next_hop != ourRelayID && p->relay_node != 0 &&
wasRelayer(p->relay_node, found) && !wasRelayer(ourRelayID, found) && !wasRelayer(found->next_hop, found)) { wasRelayer(p->relay_node, found) && !wasRelayer(ourRelayID, found) && !wasRelayer(found->next_hop, found)) {
LOG_WARN("Fallback to flooding, consider unseen relay_node=0x%x", p->relay_node); LOG_INFO("Fallback to flooding, consider unseen relay_node=0x%x", p->relay_node);
seenRecently = false; seenRecently = false;
} }
} }