Skip to content

Commit

Permalink
fix(traceroute): route lists cleared before use are always empty
Browse files Browse the repository at this point in the history
fixes #1355
  • Loading branch information
andrekir committed Oct 27, 2024
1 parent 6f7a847 commit 8af31bb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/src/main/java/com/geeksville/mesh/model/RouteDiscovery.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ val MeshProtos.MeshPacket.fullRouteDiscovery: RouteDiscovery?
get() = with(decoded) {
if (hasDecoded() && !wantResponse && portnum == Portnums.PortNum.TRACEROUTE_APP) {
runCatching { RouteDiscovery.parseFrom(payload).toBuilder() }.getOrNull()?.apply {
val fullRoute = listOf(to) + routeList + from
clearRoute()
addAllRoute(listOf(to) + routeList + from)
if (hopStart > 0 && snrBackList.size > 0) { // otherwise back route is invalid
clearRouteBack()
addAllRouteBack(listOf(from) + routeBackList + to)
addAllRoute(fullRoute)

val fullRouteBack = listOf(from) + routeBackList + to
clearRouteBack()
if (hopStart > 0 && snrBackCount > 0) { // otherwise back route is invalid
addAllRouteBack(fullRouteBack)
}
}?.build()
} else {
Expand Down

0 comments on commit 8af31bb

Please sign in to comment.