[mle] simplify WillBecomeRouterSoon for clarity (#11768)

This commit renames `IsExpectedToBecomeRouterSoon()` to
`WillBecomeRouterSoon()` to better reflect its behavior.

The implementation is simplified by using the `VerifyOrExit` pattern
instead of a single complex boolean expression, which improves code
readability.
This commit is contained in:
Abtin Keshavarzian
2025-08-01 11:10:52 -07:00
committed by GitHub
parent 9cd5a2d93e
commit 0cf1ee09eb
4 changed files with 19 additions and 8 deletions
+2 -2
View File
@@ -320,7 +320,7 @@ void DuaManager::HandleNotifierEvents(Events aEvents)
// Wait for link establishment with neighboring routers.
UpdateRegistrationDelay(kNewRouterRegistrationDelay);
}
else if (mle.IsExpectedToBecomeRouterSoon())
else if (mle.WillBecomeRouterSoon())
{
// Will check again in case the device decides to stay REED when jitter timeout expires.
UpdateRegistrationDelay(mle.GetRouterRoleTransitionTimeout() + kNewRouterRegistrationDelay + 1);
@@ -434,7 +434,7 @@ void DuaManager::PerformNextRegistration(void)
// Only send DUA.req when necessary
#if OPENTHREAD_CONFIG_DUA_ENABLE
#if OPENTHREAD_FTD
if (!mle.IsRouterOrLeader() && mle.IsExpectedToBecomeRouterSoon())
if (!mle.IsRouterOrLeader() && mle.WillBecomeRouterSoon())
{
UpdateRegistrationDelay(mle.GetRouterRoleTransitionTimeout() + kNewRouterRegistrationDelay + 1);
ExitNow();