Skip to content

Commit

Permalink
dsr: Fix DsrRouteCacheEntry operator==
Browse files Browse the repository at this point in the history
  • Loading branch information
edalm authored and TommyPec committed Jan 23, 2024
1 parent 773edd2 commit b13f46d
Showing 1 changed file with 3 additions and 29 deletions.
32 changes: 3 additions & 29 deletions src/dsr/model/dsr-rcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b13f46d

Please sign in to comment.