use the right log component name for PacketSink. use NS_LOG_FUNCTION.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 09 Aug 2008 10:52:36 -0700
changeset 3522 b2ef6249a724
parent 3521 4bc5b06f92df
child 3523 5c7524e89e10
use the right log component name for PacketSink. use NS_LOG_FUNCTION.
src/applications/packet-sink/packet-sink.cc
--- a/src/applications/packet-sink/packet-sink.cc	Fri Aug 08 16:29:15 2008 -0700
+++ b/src/applications/packet-sink/packet-sink.cc	Sat Aug 09 10:52:36 2008 -0700
@@ -33,7 +33,7 @@
 
 namespace ns3 {
 
-NS_LOG_COMPONENT_DEFINE ("PacketSinkApplication");
+NS_LOG_COMPONENT_DEFINE ("PacketSink");
 NS_OBJECT_ENSURE_REGISTERED (PacketSink);
 
 TypeId 
@@ -58,15 +58,19 @@
 
 PacketSink::PacketSink ()
 {
+  NS_LOG_FUNCTION (this);
   m_socket = 0;
 }
 
 PacketSink::~PacketSink()
-{}
+{
+  NS_LOG_FUNCTION (this);
+}
 
 void
 PacketSink::DoDispose (void)
 {
+  NS_LOG_FUNCTION (this);
   m_socket = 0;
 
   // chain up
@@ -77,6 +81,7 @@
 // Application Methods
 void PacketSink::StartApplication()    // Called at time specified by Start
 {
+  NS_LOG_FUNCTION (this);
   // Create the socket if not already
   if (!m_socket)
     {
@@ -93,6 +98,7 @@
 
 void PacketSink::StopApplication()     // Called at time specified by Stop
 {
+  NS_LOG_FUNCTION (this);
   while(!m_socketList.empty()) //these are accepted sockets, close them
   {
     Ptr<Socket> acceptedSocket = m_socketList.front();
@@ -108,6 +114,7 @@
 
 void PacketSink::HandleRead (Ptr<Socket> socket)
 {
+  NS_LOG_FUNCTION (this << socket);
   Ptr<Packet> packet;
   Address from;
   while (packet = socket->RecvFrom (from))
@@ -125,6 +132,7 @@
 
 void PacketSink::HandleAccept (Ptr<Socket> s, const Address& from)
 {
+  NS_LOG_FUNCTION (this << s << from);
   s->SetRecvCallback (MakeCallback(&PacketSink::HandleRead, this));
   m_socketList.push_back (s);
 }