Skip to content

Gate path updates to unknown, better-hop, or stale routes#1911

Open
robekl wants to merge 1 commit intomeshcore-dev:devfrom
robekl:path-update-gating-stale-or-better
Open

Gate path updates to unknown, better-hop, or stale routes#1911
robekl wants to merge 1 commit intomeshcore-dev:devfrom
robekl:path-update-gating-stale-or-better

Conversation

@robekl
Copy link

@robekl robekl commented Mar 3, 2026

Summary

This change replaces unconditional contact path overwrites with a simple acceptance gate so routing state is more stable under noisy/frequent path updates.

Problem

Current path handling effectively behaves like "last received path wins" for contact/client out_path.
That can cause route churn when equal-or-worse paths arrive after a good path.

What Changed

  • Added PATH_STALE_SECS (default 60) in:
    • src/helpers/BaseChatMesh.cpp
    • examples/simple_sensor/SensorMesh.cpp
  • Added a small helper:
    • pathHopCount(path_len) using lower 6 bits of path_len.
  • Updated path update logic to accept a new path only when:
    • existing path is unknown, or
    • new path has fewer hops, or
    • existing path is stale.
  • Added debug logs for rejected non-improving path updates.
  • Left existing ACK/response extra payload behavior unchanged.

Behavior Impact

  • Reduces path flapping.
  • Preserves fast adoption of clearly better paths.
  • Allows recovery from stale routes without introducing multi-path complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant