From 23b364147658bd7f66a317159cc9fdba8bbb0ee8 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 16 Apr 2024 12:50:40 -0700 Subject: [PATCH] [mle] restart role transition timeout from `SetRouterEligible(true)` (#10033) Updates `MleRouter::SetRouterEligible()` to restart the role transition timer if the device is a child and the router eligibility is changed to `true`. --- src/core/thread/mle_router.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index b55341f9b..26c6541e7 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -157,7 +157,12 @@ Error MleRouter::SetRouterEligible(bool aEligible) { Error error = kErrorNone; - VerifyOrExit(IsFullThreadDevice() || !aEligible, error = kErrorNotCapable); + if (!IsFullThreadDevice()) + { + VerifyOrExit(!aEligible, error = kErrorNotCapable); + } + + VerifyOrExit(aEligible != mRouterEligible); mRouterEligible = aEligible; @@ -168,6 +173,11 @@ Error MleRouter::SetRouterEligible(bool aEligible) break; case kRoleChild: + if (mRouterEligible) + { + mRouterRoleTransition.StartTimeout(); + } + Get().SetBeaconEnabled(mRouterEligible); break;