[mle] prefer higher weight partition even if singleton (#6809)

Rules for partitions preference were updated.
This commit is contained in:
Eduardo Montoya
2021-07-13 13:39:31 -07:00
committed by GitHub
parent f107e139f8
commit feec2e6a6d
+5 -5
View File
@@ -1101,16 +1101,16 @@ int MleRouter::ComparePartitions(bool aSingletonA,
{
int rval = 0;
if (aSingletonA != aSingletonB)
{
ExitNow(rval = aSingletonB ? 1 : -1);
}
if (aLeaderDataA.GetWeighting() != aLeaderDataB.GetWeighting())
{
ExitNow(rval = aLeaderDataA.GetWeighting() > aLeaderDataB.GetWeighting() ? 1 : -1);
}
if (aSingletonA != aSingletonB)
{
ExitNow(rval = aSingletonB ? 1 : -1);
}
if (aLeaderDataA.GetPartitionId() != aLeaderDataB.GetPartitionId())
{
ExitNow(rval = aLeaderDataA.GetPartitionId() > aLeaderDataB.GetPartitionId() ? 1 : -1);