use the right log component name for PacketSink. use NS_LOG_FUNCTION.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat Aug 09 10:52:36 2008 -0700 (18 months ago)
changeset 3538b2ef6249a724
parent 3537 4bc5b06f92df
child 3539 5c7524e89e10
use the right log component name for PacketSink. use NS_LOG_FUNCTION.
src/applications/packet-sink/packet-sink.cc
     1.1 --- a/src/applications/packet-sink/packet-sink.cc	Fri Aug 08 16:29:15 2008 -0700
     1.2 +++ b/src/applications/packet-sink/packet-sink.cc	Sat Aug 09 10:52:36 2008 -0700
     1.3 @@ -33,7 +33,7 @@
     1.4  
     1.5  namespace ns3 {
     1.6  
     1.7 -NS_LOG_COMPONENT_DEFINE ("PacketSinkApplication");
     1.8 +NS_LOG_COMPONENT_DEFINE ("PacketSink");
     1.9  NS_OBJECT_ENSURE_REGISTERED (PacketSink);
    1.10  
    1.11  TypeId 
    1.12 @@ -58,15 +58,19 @@
    1.13  
    1.14  PacketSink::PacketSink ()
    1.15  {
    1.16 +  NS_LOG_FUNCTION (this);
    1.17    m_socket = 0;
    1.18  }
    1.19  
    1.20  PacketSink::~PacketSink()
    1.21 -{}
    1.22 +{
    1.23 +  NS_LOG_FUNCTION (this);
    1.24 +}
    1.25  
    1.26  void
    1.27  PacketSink::DoDispose (void)
    1.28  {
    1.29 +  NS_LOG_FUNCTION (this);
    1.30    m_socket = 0;
    1.31  
    1.32    // chain up
    1.33 @@ -77,6 +81,7 @@
    1.34  // Application Methods
    1.35  void PacketSink::StartApplication()    // Called at time specified by Start
    1.36  {
    1.37 +  NS_LOG_FUNCTION (this);
    1.38    // Create the socket if not already
    1.39    if (!m_socket)
    1.40      {
    1.41 @@ -93,6 +98,7 @@
    1.42  
    1.43  void PacketSink::StopApplication()     // Called at time specified by Stop
    1.44  {
    1.45 +  NS_LOG_FUNCTION (this);
    1.46    while(!m_socketList.empty()) //these are accepted sockets, close them
    1.47    {
    1.48      Ptr<Socket> acceptedSocket = m_socketList.front();
    1.49 @@ -108,6 +114,7 @@
    1.50  
    1.51  void PacketSink::HandleRead (Ptr<Socket> socket)
    1.52  {
    1.53 +  NS_LOG_FUNCTION (this << socket);
    1.54    Ptr<Packet> packet;
    1.55    Address from;
    1.56    while (packet = socket->RecvFrom (from))
    1.57 @@ -125,6 +132,7 @@
    1.58  
    1.59  void PacketSink::HandleAccept (Ptr<Socket> s, const Address& from)
    1.60  {
    1.61 +  NS_LOG_FUNCTION (this << s << from);
    1.62    s->SetRecvCallback (MakeCallback(&PacketSink::HandleRead, this));
    1.63    m_socketList.push_back (s);
    1.64  }