Commit 2b3b56d
authored
[mle] separate role transition and leader age checks (openthread#12853)
This commit updates `Mle::HandleTimeTick()` to separate the processing
of role transitions and the checking of the leader's age into two
distinct `switch` statements.
Previously, these two checks were combined in a single `switch`
statement with complex fall-through logic. This structure contained
two issues:
1. For a device in the `kRoleChild` state, if the role transition
timeout expired, the code would execute `ExitNow()`. This
unintentionally skipped the leader age check and the rest of the
operations in `Mle::HandleTimeTick()`, such as updating the
`ChildTable` and `RouterTable`.
2. A non-router-eligible child would incorrectly fall through and
perform the leader age check. The new logic adds an explicit check
using `IsRouterEligible()` to ensure only router-eligible children
monitor the leader's age.
By separating the logic into two blocks, the code is simplified and
we avoid the brittle fall-through behavior and ensure that all time
tick operations are consistently executed regardless of the device's
role or role transition state.1 parent 2a120a9 commit 2b3b56d
1 file changed
Lines changed: 45 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1533 | 1533 | | |
1534 | 1534 | | |
1535 | 1535 | | |
1536 | | - | |
1537 | | - | |
1538 | 1536 | | |
1539 | 1537 | | |
1540 | 1538 | | |
| |||
1555 | 1553 | | |
1556 | 1554 | | |
1557 | 1555 | | |
1558 | | - | |
1559 | | - | |
1560 | | - | |
| 1556 | + | |
1561 | 1557 | | |
1562 | | - | |
1563 | | - | |
| 1558 | + | |
| 1559 | + | |
1564 | 1560 | | |
1565 | | - | |
1566 | | - | |
| 1561 | + | |
1567 | 1562 | | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
1568 | 1568 | | |
1569 | 1569 | | |
1570 | 1570 | | |
| |||
1581 | 1581 | | |
1582 | 1582 | | |
1583 | 1583 | | |
1584 | | - | |
1585 | | - | |
| 1584 | + | |
1586 | 1585 | | |
1587 | | - | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
1588 | 1592 | | |
1589 | | - | |
1590 | | - | |
| 1593 | + | |
1591 | 1594 | | |
1592 | | - | |
1593 | | - | |
1594 | | - | |
1595 | | - | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
1596 | 1603 | | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
1597 | 1615 | | |
1598 | | - | |
| 1616 | + | |
| 1617 | + | |
1599 | 1618 | | |
1600 | | - | |
1601 | | - | |
| 1619 | + | |
1602 | 1620 | | |
1603 | 1621 | | |
1604 | 1622 | | |
1605 | 1623 | | |
1606 | | - | |
1607 | | - | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
1608 | 1628 | | |
1609 | | - | |
1610 | | - | |
| 1629 | + | |
| 1630 | + | |
1611 | 1631 | | |
1612 | 1632 | | |
1613 | 1633 | | |
1614 | | - | |
1615 | | - | |
1616 | | - | |
1617 | 1634 | | |
1618 | 1635 | | |
1619 | 1636 | | |
| |||
0 commit comments