From 8af31bb0d0f2f587b30a00cb748835e1fa62e5cf Mon Sep 17 00:00:00 2001 From: andrekir Date: Sun, 27 Oct 2024 10:16:17 -0300 Subject: [PATCH] fix(traceroute): route lists cleared before use are always empty fixes #1355 --- .../java/com/geeksville/mesh/model/RouteDiscovery.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/model/RouteDiscovery.kt b/app/src/main/java/com/geeksville/mesh/model/RouteDiscovery.kt index 77098f23d..4a8fd5dcc 100644 --- a/app/src/main/java/com/geeksville/mesh/model/RouteDiscovery.kt +++ b/app/src/main/java/com/geeksville/mesh/model/RouteDiscovery.kt @@ -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 {