If packet traveled 1 hop, set `relay_node` as `next_hop` for the original transmitter

pull/2856/head
GUVWAF 2023-10-14 17:18:05 +02:00
rodzic 9b1dd75549
commit 27a492adf8
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -795,6 +795,9 @@ void NodeDB::updateFrom(const meshtastic_MeshPacket &mp)
// If this packet didn't travel any hops, then it was sent directly to us, so we know what to use as next hop to this node
if (mp.original_hop_limit == mp.hop_limit) {
info->next_hop = (uint8_t)(mp.from & 0xFF);
} else if (mp.relay_node && (mp.original_hop_limit - mp.hop_limit == 1)) {
// This packet traveled one hop, so we can use the relay_node as next_hop
info->next_hop = (uint8_t)(mp.relay_node & 0xFF);
}
}
}