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