diff --git a/samples/main-p2p-net-device-if.cc b/samples/main-p2p-net-device-if.cc index 7a32c7ea2..2043079c1 100644 --- a/samples/main-p2p-net-device-if.cc +++ b/samples/main-p2p-net-device-if.cc @@ -52,7 +52,7 @@ public: { NodeList::NodeIndex nodeIndex; context.Get (nodeIndex); - m_filestr << "node=" << NodeList::GetNode (nodeIndex)->GetId () << " "; + m_filestr << "node=" << NodeList::PeekNode (nodeIndex)->GetId () << " "; Ipv4::InterfaceIndex interfaceIndex; context.Get (interfaceIndex); m_filestr << "interface=" << interfaceIndex << " "; diff --git a/src/node/ascii-trace.cc b/src/node/ascii-trace.cc index 8b0c9ef2e..3ded1a0f5 100644 --- a/src/node/ascii-trace.cc +++ b/src/node/ascii-trace.cc @@ -110,7 +110,7 @@ AsciiTrace::LogDevQueue (TraceContext const &context, Packet const &packet) m_os << Simulator::Now ().GetSeconds () << " "; NodeList::NodeIndex nodeIndex; context.Get (nodeIndex); - m_os << "node=" << NodeList::GetNode (nodeIndex)->GetId () << " "; + m_os << "node=" << NodeList::PeekNode (nodeIndex)->GetId () << " "; Ipv4::InterfaceIndex interfaceIndex; context.Get (interfaceIndex); m_os << "interface=" << interfaceIndex << " "; @@ -124,7 +124,7 @@ AsciiTrace::LogDevRx (TraceContext const &context, Packet &p) m_os << "r " << Simulator::Now ().GetSeconds () << " "; NodeList::NodeIndex nodeIndex; context.Get (nodeIndex); - m_os << "node=" << NodeList::GetNode (nodeIndex)->GetId () << " "; + m_os << "node=" << NodeList::PeekNode (nodeIndex)->GetId () << " "; Ipv4::InterfaceIndex interfaceIndex; context.Get (interfaceIndex); m_os << "interface=" << interfaceIndex << " "; diff --git a/src/node/node-list.cc b/src/node/node-list.cc index 0f88f2a76..f1e305275 100644 --- a/src/node/node-list.cc +++ b/src/node/node-list.cc @@ -69,6 +69,7 @@ NodeListPriv::~NodeListPriv () i != m_nodes.end (); i++) { Node *node = *i; + node->Dispose (); node->Unref (); } m_nodes.erase (m_nodes.begin (), m_nodes.end ()); @@ -94,13 +95,6 @@ NodeListPriv::End (void) { return m_nodes.end (); } -Node * -NodeListPriv::GetNode (uint32_t n) -{ - Node *node = m_nodes[n]; - node->Ref (); - return node; -} uint32_t NodeListPriv::GetNNodes (void) { @@ -153,9 +147,9 @@ NodeList::CreateTraceResolver (TraceContext const &context) return SimulationSingleton::Get ()->CreateTraceResolver (context); } Node * -NodeList::GetNode (uint32_t n) +NodeList::PeekNode (uint32_t n) { - return SimulationSingleton::Get ()->GetNode (n); + return SimulationSingleton::Get ()->PeekNode (n); } diff --git a/src/node/node-list.h b/src/node/node-list.h index 190d2cbaf..57d8bf663 100644 --- a/src/node/node-list.h +++ b/src/node/node-list.h @@ -42,7 +42,7 @@ public: static Iterator End (void); static TraceResolver *CreateTraceResolver (TraceContext const &context); - static Node *GetNode (uint32_t n); + static Node *PeekNode (uint32_t n); }; }//namespace ns3 diff --git a/src/node/pcap-trace.cc b/src/node/pcap-trace.cc index acc478bcf..467476490 100644 --- a/src/node/pcap-trace.cc +++ b/src/node/pcap-trace.cc @@ -84,7 +84,7 @@ PcapTrace::LogIp (TraceContext const &context, Packet const &p, uint32_t interfa { NodeList::NodeIndex nodeIndex; context.Get (nodeIndex); - uint32_t nodeId = NodeList::GetNode (nodeIndex)->GetId (); + uint32_t nodeId = NodeList::PeekNode (nodeIndex)->GetId (); PcapWriter *writer = GetStream (nodeId, interfaceIndex); writer->WritePacket (p); }