mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 09:07:47 +00:00
[mle] change IsFullThreadDevice to IsRouterEligible where appropriate (#4363)
This commit is contained in:
@@ -376,10 +376,7 @@ bool MleRouter::HandleAdvertiseTimer(void)
|
||||
{
|
||||
bool continueTrickle = true;
|
||||
|
||||
if (!IsFullThreadDevice())
|
||||
{
|
||||
ExitNow(continueTrickle = false);
|
||||
}
|
||||
VerifyOrExit(IsRouterEligible(), continueTrickle = false);
|
||||
|
||||
SendAdvertisement();
|
||||
|
||||
@@ -1077,7 +1074,7 @@ bool MleRouter::IsSingleton(void)
|
||||
{
|
||||
bool rval = true;
|
||||
|
||||
if (IsAttached() && IsFullThreadDevice())
|
||||
if (IsAttached() && IsRouterEligible())
|
||||
{
|
||||
// not a singleton if any other routers exist
|
||||
if (mRouterTable.GetActiveRouterCount() > 1)
|
||||
@@ -2653,7 +2650,7 @@ otError MleRouter::HandleDiscoveryRequest(const Message &aMessage, const Ip6::Me
|
||||
LogMleMessage("Receive Discovery Request", aMessageInfo.GetPeerAddr());
|
||||
|
||||
// only Routers and REEDs respond
|
||||
VerifyOrExit(IsFullThreadDevice(), error = OT_ERROR_INVALID_STATE);
|
||||
VerifyOrExit(IsRouterEligible(), error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
// find MLE Discovery TLV
|
||||
VerifyOrExit(Tlv::GetOffset(aMessage, Tlv::kDiscovery, offset) == OT_ERROR_NONE, error = OT_ERROR_PARSE);
|
||||
|
||||
@@ -356,8 +356,7 @@ otError Local::SendServerDataNotification(void)
|
||||
#if OPENTHREAD_FTD
|
||||
|
||||
// Don't send this Server Data Notification if the device is going to upgrade to Router
|
||||
if (Get<Mle::MleRouter>().IsFullThreadDevice() && Get<Mle::MleRouter>().IsRouterEligible() &&
|
||||
(Get<Mle::MleRouter>().GetRole() < OT_DEVICE_ROLE_ROUTER) &&
|
||||
if (Get<Mle::MleRouter>().IsRouterEligible() && (Get<Mle::MleRouter>().GetRole() < OT_DEVICE_ROLE_ROUTER) &&
|
||||
(Get<RouterTable>().GetActiveRouterCount() < Get<Mle::MleRouter>().GetRouterUpgradeThreshold()))
|
||||
{
|
||||
ExitNow(error = OT_ERROR_INVALID_STATE);
|
||||
|
||||
Reference in New Issue
Block a user