route cost to self (#1787)

This commit is contained in:
Buke Po
2017-05-18 20:53:23 -07:00
committed by Jonathan Hui
parent 9bcc2ccfe4
commit 4f5b17ab0b
+3 -1
View File
@@ -386,7 +386,9 @@ ThreadError LeaderBase::DefaultRouteLookup(PrefixTlv &aPrefix, uint16_t *aRloc16
if (route == NULL ||
entry->GetPreference() > route->GetPreference() ||
(entry->GetPreference() == route->GetPreference() &&
mNetif.GetMle().GetCost(entry->GetRloc()) < mNetif.GetMle().GetCost(route->GetRloc())))
(entry->GetRloc() == mNetif.GetMle().GetRloc16() ||
(route->GetRloc() != mNetif.GetMle().GetRloc16() &&
mNetif.GetMle().GetCost(entry->GetRloc()) < mNetif.GetMle().GetCost(route->GetRloc())))))
{
route = entry;
}