mesh: cleaner struct init in HwmpRtable::AddReactivePath()
Initialize ReactiveRoute struct before inserting into m_routes map to avoid unnecessary search.
This commit is contained in:
committed by
Eduardo Almeida
parent
abe6057031
commit
6661c04a74
@@ -59,19 +59,12 @@ HwmpRtable::AddReactivePath(Mac48Address destination,
|
|||||||
{
|
{
|
||||||
NS_LOG_FUNCTION(this << destination << retransmitter << interface << metric
|
NS_LOG_FUNCTION(this << destination << retransmitter << interface << metric
|
||||||
<< lifetime.GetSeconds() << seqnum);
|
<< lifetime.GetSeconds() << seqnum);
|
||||||
auto i = m_routes.find(destination);
|
auto& route = m_routes[destination]; // find existing record or create new
|
||||||
if (i == m_routes.end())
|
route.retransmitter = retransmitter;
|
||||||
{
|
route.interface = interface;
|
||||||
ReactiveRoute newroute;
|
route.metric = metric;
|
||||||
m_routes[destination] = newroute;
|
route.whenExpire = Simulator::Now() + lifetime;
|
||||||
}
|
route.seqnum = seqnum;
|
||||||
i = m_routes.find(destination);
|
|
||||||
NS_ASSERT(i != m_routes.end());
|
|
||||||
i->second.retransmitter = retransmitter;
|
|
||||||
i->second.interface = interface;
|
|
||||||
i->second.metric = metric;
|
|
||||||
i->second.whenExpire = Simulator::Now() + lifetime;
|
|
||||||
i->second.seqnum = seqnum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user