[network-data] limit router upgrade delay when registering (#6613)

If a device is a REED and waiting the random delay to upgrade to a
router, the device will wait to register its network data, since it
will have to register again after upgrading to a router. However, the
maximum delay for becoming a router is up to 2 minutes, which is a
long time to wait.

This commit limits the delay that a device will wait to register its
network data.
This commit is contained in:
Jonathan Hui
2021-05-12 11:48:14 -07:00
committed by GitHub
parent 45a23d89fe
commit 2f637e99fd
4 changed files with 11 additions and 10 deletions
+2 -2
View File
@@ -321,7 +321,7 @@ void DuaManager::HandleNotifierEvents(Events aEvents)
// Wait for link establishment with neighboring routers.
UpdateRegistrationDelay(kNewRouterRegistrationDelay);
}
else if (mle.IsExpectedToBecomeRouter())
else if (mle.IsExpectedToBecomeRouterSoon())
{
// Will check again in case the device decides to stay REED when jitter timeout expires.
UpdateRegistrationDelay(mle.GetRouterSelectionJitterTimeout() + kNewRouterRegistrationDelay + 1);
@@ -435,7 +435,7 @@ void DuaManager::PerformNextRegistration(void)
// Only send DUA.req when necessary
#if OPENTHREAD_CONFIG_DUA_ENABLE
#if OPENTHREAD_FTD
VerifyOrExit(mle.IsRouterOrLeader() || !mle.IsExpectedToBecomeRouter(), error = kErrorInvalidState);
VerifyOrExit(mle.IsRouterOrLeader() || !mle.IsExpectedToBecomeRouterSoon(), error = kErrorInvalidState);
#endif
VerifyOrExit(mle.IsFullThreadDevice() || mle.GetParent().IsThreadVersion1p1(), error = kErrorInvalidState);
#endif // OPENTHREAD_CONFIG_DUA_ENABLE