Bugzilla – Bug 563
example/stats calling old callbacks
Last modified: 2009-06-24 10:47:46 EDT
You need to log in before you can comment on or make changes to this bug.
In file examples/stats/wifi-example-sim.cc: line 204: Config::Connect("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Tx", MakeBoundCallback(&TxCallback, totalTx)); line 215: Config::Connect("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Rx", MakeCallback(&PacketCounterCalculator::FrameUpdate, totalRx)); The callbacks aren't anymore there. As a result the counted values are zero. My best solution is to bind those to: $ns3::WifiNetDevice/Mac/MacTx and $ns3::WifiNetDevice/Mac/MacRx respectively. Moreover in examples/stats/wifi-example-apps.cc, in the function Receiver::Receive(Ptr<Socket> socket) there is no check if the TimeTag is present or not. Impossible? Not really, there's another bug somewhere, but it will be covered in another ticket. I'd change the function into this: void Receiver::Receive(Ptr<Socket> socket) { // NS_LOG_FUNCTION (this << socket << packet << from); Ptr<Packet> packet; Address from; while (packet = socket->RecvFrom(from)) { if (InetSocketAddress::IsMatchingType (from)) { InetSocketAddress address = InetSocketAddress::ConvertFrom (from); NS_LOG_INFO ("Received " << packet->GetSize() << " bytes from " << address.GetIpv4()); } TimestampTag timestamp; if( packet->FindFirstMatchingTag(timestamp) ) { Time tx = timestamp.GetTimestamp(); if (m_delay != 0) { m_delay->Update(Simulator::Now() - tx); } } else { NS_LOG_INFO ("** missing time tag **"); } if (m_calc != 0) { m_calc->Update(); } // end receiving packets } // end Receiver::Receive }
Can you please submit a patch for review? Thanks
Created an attachment (id=441) [details] examples/stats patch described above Sure thing, here is the patch file. Cheers
Created an attachment (id=451) [details] update the function signatures too
These fixes have been added to the main branch. Thanks!