From afcc48eddec3a43cc856be6d4423bdbd906edc66 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 22 Nov 2022 18:21:13 -0800 Subject: [PATCH] [router-table] remove duplicate method (#8434) This commit removes `RouterTable::GetActiveLinkCount()` and uses `GetNeighborCount()` instead (which does the same). --- src/core/thread/mle_router.cpp | 2 +- src/core/thread/router_table.cpp | 15 --------------- src/core/thread/router_table.hpp | 8 -------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index 12237e163..f90b3328c 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -1406,7 +1406,7 @@ Error MleRouter::HandleAdvertisement(RxInfo &aRxInfo) VerifyOrExit(router != nullptr); if (IsFullThreadDevice() && !router->IsStateValid() && !router->IsStateLinkRequest() && - (mRouterTable.GetActiveLinkCount() < OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS)) + (mRouterTable.GetNeighborCount() < OPENTHREAD_CONFIG_MLE_CHILD_ROUTER_LINKS)) { router->SetExtAddress(extAddr); router->GetLinkInfo().Clear(); diff --git a/src/core/thread/router_table.cpp b/src/core/thread/router_table.cpp index 163a8c44f..8f324832f 100644 --- a/src/core/thread/router_table.cpp +++ b/src/core/thread/router_table.cpp @@ -342,21 +342,6 @@ void RouterTable::RemoveRouterLink(Router &aRouter) } } -uint8_t RouterTable::GetActiveLinkCount(void) const -{ - uint8_t activeLinks = 0; - - for (const Router *router = GetFirstEntry(); router != nullptr; router = GetNextEntry(router)) - { - if (router->IsStateValid()) - { - activeLinks++; - } - } - - return activeLinks; -} - const Router *RouterTable::FindRouter(const Router::AddressMatcher &aMatcher) const { const Router *router; diff --git a/src/core/thread/router_table.hpp b/src/core/thread/router_table.hpp index d2e2721ce..39ea380ca 100644 --- a/src/core/thread/router_table.hpp +++ b/src/core/thread/router_table.hpp @@ -147,14 +147,6 @@ public: */ uint8_t GetActiveRouterCount(void) const { return mActiveRouterCount; } - /** - * This method returns the number of active links with neighboring routers. - * - * @returns The number of active links with neighboring routers. - * - */ - uint8_t GetActiveLinkCount(void) const; - /** * This method returns the leader in the Thread network. *