merge in raj's dispose early work
parent
4206fd3bce
commit
9eaf9191d8
|
@ -106,6 +106,16 @@ PointToPointNetDevice::PointToPointNetDevice (const PointToPointNetDevice& nd)
|
|||
|
||||
}
|
||||
|
||||
void PointToPointNetDevice::Dispose()
|
||||
{
|
||||
if (m_channel != 0)
|
||||
{
|
||||
m_channel->Unref ();
|
||||
m_channel = 0;
|
||||
}
|
||||
NetDevice::Dispose ();
|
||||
}
|
||||
|
||||
//
|
||||
// Assignment operator for PointToPointNetDevice.
|
||||
//
|
||||
|
@ -357,6 +367,7 @@ PointToPointNetDevice::GetQueue(void) const
|
|||
Channel*
|
||||
PointToPointNetDevice::DoGetChannel(void) const
|
||||
{
|
||||
m_channel->Ref();
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,10 @@ public:
|
|||
* This is the destructor for the PointToPointNetDevice.
|
||||
*/
|
||||
virtual ~PointToPointNetDevice();
|
||||
/**
|
||||
*Dispose method for refcounting
|
||||
*/
|
||||
virtual void Dispose();
|
||||
/**
|
||||
* Assignment Operator for a PointToPointNetDevice
|
||||
*
|
||||
|
|
|
@ -106,6 +106,12 @@ InternetNode::CreateTraceResolver (TraceContext const &context)
|
|||
return resolver;
|
||||
}
|
||||
|
||||
void InternetNode::Dispose()
|
||||
{
|
||||
for(uint32_t i=0;i<GetNDevices();++i)
|
||||
GetDevice(i)->Dispose();
|
||||
|
||||
}
|
||||
|
||||
ApplicationList*
|
||||
InternetNode::GetApplicationList() const
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
virtual ~InternetNode ();
|
||||
virtual InternetNode* Copy() const;
|
||||
virtual TraceResolver *CreateTraceResolver (TraceContext const &context);
|
||||
virtual void Dispose();
|
||||
// Capability access
|
||||
virtual ApplicationList* GetApplicationList() const;
|
||||
virtual L3Demux* GetL3Demux() const;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "net-device.h"
|
||||
#include "llc-snap-header.h"
|
||||
#include "node.h"
|
||||
#include "ns3/channel.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
@ -225,4 +226,9 @@ NetDevice::SetReceiveCallback (Callback<bool,NetDevice *,const Packet &,uint16_t
|
|||
m_receiveCallback = cb;
|
||||
}
|
||||
|
||||
void
|
||||
NetDevice::Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
}; // namespace ns3
|
||||
|
|
|
@ -155,6 +155,8 @@ class NetDevice {
|
|||
bool NeedsArp (void) const;
|
||||
|
||||
void SetReceiveCallback (Callback<bool,NetDevice *,const Packet &,uint16_t> cb);
|
||||
|
||||
virtual void Dispose();
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
|
@ -87,6 +87,10 @@ Node::GetNDevices (void) const
|
|||
return m_devices.size ();
|
||||
}
|
||||
|
||||
void Node::Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
// Node stack creation and management routines.
|
||||
Node* Node::Create()
|
||||
{
|
||||
|
|
|
@ -122,6 +122,8 @@ public:
|
|||
uint32_t AddDevice (NetDevice *device);
|
||||
NetDevice *GetDevice (uint32_t index) const;
|
||||
uint32_t GetNDevices (void) const;
|
||||
|
||||
virtual void Dispose();
|
||||
|
||||
private:
|
||||
virtual void DoAddDevice (NetDevice *device) const = 0;
|
||||
|
|
Loading…
Reference in New Issue