2009-04-01

NS-3 and Packet::Copy

Grr! I have lost track of how many times I forgot that I need to packet->Copy () some packet. Or how many wasted hours of work. Clearly the worst design decision in NS-3, ever.


for (std::set::const_iterator poaI = binding.oldPoas.begin ();
poaI != binding.oldPoas.end (); poaI++)
{
NS_LOG_LOGIC ("Terminal " << terminal << " associated; sending BU (terminal=" << terminal
<< ", newPoA=" << bu.newPoa << ") to " << *poaI);
- m_buAgent->SendBu (packet, *poaI, msg.GetMessageSequenceNumber (), bu.terminal);
+ m_buAgent->SendBu (packet->Copy (), *poaI, msg.GetMessageSequenceNumber (), bu.terminal);
}



Note to self: in the future, when ever transmitting a packet inside a for-loop, make sure to Copy each transmitted packet!

No comments: