dsr: Fix DsrRouteCacheEntry operator==

This commit is contained in:
Eduardo Almeida
2024-01-23 03:43:47 +00:00
committed by Tommaso Pecorella
parent 773edd2765
commit b13f46d78e

View File

@@ -345,41 +345,15 @@ class DsrRouteCacheEntry
void Print(std::ostream& os) const;
/**
* \brief Compare the route cache entry
* \brief Compare the route cache entry. Only the paths are compared.
* \param o entry to compare
* \return true if equal
* \return true if both route cache entries are equal
*/
bool operator==(const DsrRouteCacheEntry& o) const
{
if (m_path.size() != o.m_path.size())
{
NS_ASSERT(false);
return false;
}
auto j = o.m_path.begin();
for (auto i = m_path.begin(); i != m_path.end(); i++, j++)
{
/*
* Verify if neither the entry are not 0 and they equal to each other
*/
if (((*i) == nullptr) || ((*j) == nullptr))
{
return false;
}
else if (!((*i) == (*j)))
{
return false;
}
else
{
return true;
}
}
return false;
return m_path == o.m_path;
}
// \}
private:
Timer m_ackTimer; ///< RREP_ACK timer
Ipv4Address m_dst; ///< The destination Ip address