mirror of
https://github.com/espressif/openthread.git
synced 2026-09-02 23:30:07 +00:00
[addr-resolver] use new linked list method to find cache entry matching an EID (#5174)
This commit is contained in:
committed by
Jonathan Hui
parent
5ebd885996
commit
30343ce753
@@ -223,24 +223,6 @@ void AddressResolver::Remove(Mac::ShortAddress aRloc16, bool aMatchRouterId)
|
||||
}
|
||||
}
|
||||
|
||||
AddressResolver::CacheEntry *AddressResolver::FindCacheEntryInList(CacheEntryList & aList,
|
||||
const Ip6::Address &aEid,
|
||||
CacheEntry *& aPrevEntry)
|
||||
{
|
||||
CacheEntry *entry;
|
||||
|
||||
for (CacheEntry *prev = nullptr; (entry = GetEntryAfter(prev, aList)) != nullptr; prev = entry)
|
||||
{
|
||||
if (entry->GetTarget() == aEid)
|
||||
{
|
||||
aPrevEntry = prev;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
AddressResolver::CacheEntry *AddressResolver::FindCacheEntry(const Ip6::Address &aEid,
|
||||
CacheEntryList *& aList,
|
||||
CacheEntry *& aPrevEntry)
|
||||
@@ -251,7 +233,7 @@ AddressResolver::CacheEntry *AddressResolver::FindCacheEntry(const Ip6::Address
|
||||
for (size_t index = 0; index < OT_ARRAY_LENGTH(lists); index++)
|
||||
{
|
||||
aList = lists[index];
|
||||
entry = FindCacheEntryInList(*aList, aEid, aPrevEntry);
|
||||
entry = aList->FindMatching(aEid, aPrevEntry);
|
||||
VerifyOrExit(entry == nullptr, OT_NOOP);
|
||||
}
|
||||
|
||||
|
||||
@@ -220,6 +220,8 @@ private:
|
||||
bool CanEvict(void) const { return mInfo.mOther.mCanEvict; }
|
||||
void SetCanEvict(bool aCanEvict) { mInfo.mOther.mCanEvict = aCanEvict; }
|
||||
|
||||
bool Matches(const Ip6::Address &aEid) const { return GetTarget() == aEid; }
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
@@ -271,7 +273,6 @@ private:
|
||||
|
||||
void Remove(Mac::ShortAddress aRloc16, bool aMatchRouterId);
|
||||
void Remove(const Ip6::Address &aEid, Reason aReason);
|
||||
CacheEntry *FindCacheEntryInList(CacheEntryList &aList, const Ip6::Address &aEid, CacheEntry *&aPrevEntry);
|
||||
CacheEntry *FindCacheEntry(const Ip6::Address &aEid, CacheEntryList *&aList, CacheEntry *&aPrevEntry);
|
||||
CacheEntry *NewCacheEntry(bool aSnoopedEntry);
|
||||
void RemoveCacheEntry(CacheEntry &aEntry, CacheEntryList &aList, CacheEntry *aPrevEntry, Reason aReason);
|
||||
|
||||
Reference in New Issue
Block a user