[router-table] signal if router is removed from UpdateRouterIdSet() (#8573)

This commit updates the `RouterTable::RemoveRouter()` to check
if `Router` being removed is a neighbor and signal its removal.
This ensures that we correctly signal neighboring router removal
from a call to either `UpdateRouterIdSet()` or `Release(aRouterId)`.
This commit is contained in:
Abtin Keshavarzian
2022-12-22 10:41:08 -08:00
committed by GitHub
parent ddde5fa5d6
commit 289d24e06e
+5 -5
View File
@@ -101,6 +101,11 @@ void RouterTable::RemoveRouter(Router &aRouter)
// Remove an existing `aRouter` entry from `mRouters` and update the
// `mRouterIdMap`.
if (aRouter.IsStateValid())
{
Get<NeighborTable>().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<NeighborTable>().Signal(NeighborTable::kRouterRemoved, *router);
}
RemoveRouter(*router);
for (Router &otherRouter : mRouters)