diff --git a/src/core/thread/router_table.cpp b/src/core/thread/router_table.cpp index ed836195e..838022a7a 100644 --- a/src/core/thread/router_table.cpp +++ b/src/core/thread/router_table.cpp @@ -101,6 +101,11 @@ void RouterTable::RemoveRouter(Router &aRouter) // Remove an existing `aRouter` entry from `mRouters` and update the // `mRouterIdMap`. + if (aRouter.IsStateValid()) + { + Get().Signal(NeighborTable::kRouterRemoved, aRouter); + } + mRouterIdMap.Release(aRouter.GetRouterId()); mRouters.Remove(aRouter); @@ -186,11 +191,6 @@ Error RouterTable::Release(uint8_t aRouterId) router = FindRouterById(aRouterId); VerifyOrExit(router != nullptr, error = kErrorNotFound); - if (router->IsStateValid()) - { - Get().Signal(NeighborTable::kRouterRemoved, *router); - } - RemoveRouter(*router); for (Router &otherRouter : mRouters)