[Ns-bugs] [Bug 563] New: example/stats calling old callbacks
code@nsnam.ece.gatech.edu
code at nsnam.ece.gatech.edu
Sat May 9 06:44:26 PDT 2009
http://www.nsnam.org/bugzilla/show_bug.cgi?id=563
Summary: example/stats calling old callbacks
Product: ns-3
Version: ns-3-dev
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: P5
Component: sample programs
AssignedTo: ns-bugs at isi.edu
ReportedBy: tommaso.pecorella at unifi.it
Estimated Hours: 0.0
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
}
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Ns-bugs
mailing list