[mle] enable state update timer when enabling router role (#4094)
The state update timer should be started when enabling router role and
attached to a network.
diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp
index 7fe9b36..8a76169 100644
--- a/src/core/thread/mle_router.cpp
+++ b/src/core/thread/mle_router.cpp
@@ -125,6 +125,11 @@
break;
}
+
+ if (IsRouterRoleEnabled() && IsAttached() && !mStateUpdateTimer.IsRunning())
+ {
+ mStateUpdateTimer.Start(kStateUpdatePeriod);
+ }
}
otError MleRouter::BecomeRouter(ThreadStatusTlv::Status aStatus)