fix: Correctly compare hopStart and hopLimit for received packets

fixes: #1304

The calculation of `hopsAway` was using an incorrect comparison between `hopStart` and `hopLimit`. This commit fixes the logic to correctly determine the number of hops a packet has traveled.
pull/1307/head
James Rich 2024-10-11 13:16:15 -05:00 zatwierdzone przez Andre K
rodzic cf2315cb66
commit ed2703c77a
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -1101,7 +1101,7 @@ class MeshService : Service(), Logging {
it.rssi = packet.rxRssi
// Generate our own hopsAway, comparing hopStart to hopLimit.
it.hopsAway = if (packet.hopStart == 0 || packet.hopLimit < packet.hopStart) {
it.hopsAway = if (packet.hopStart == 0 || packet.hopLimit > packet.hopStart) {
-1
} else {
packet.hopStart - packet.hopLimit