mirror of
https://github.com/espressif/openthread.git
synced 2026-08-14 22:57:46 +00:00
[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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user