fix bug 431 -- memory leak in bridge net device
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//
|
||||
// Default network topology includes some number of AP nodes specified by
|
||||
// the variable nWifis (defaults to two). Off of each AP node, there are some
|
||||
// number of STA nodes specified by the variable nStas (defaults to two).
|
||||
@@ -176,6 +177,7 @@ int main (int argc, char *argv[])
|
||||
dest = tmp;
|
||||
protocol = "ns3::PacketSocketFactory";
|
||||
}
|
||||
|
||||
OnOffHelper onoff = OnOffHelper (protocol, dest);
|
||||
onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (1)));
|
||||
onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0)));
|
||||
@@ -183,11 +185,10 @@ int main (int argc, char *argv[])
|
||||
apps.Start (Seconds (0.5));
|
||||
apps.Stop (Seconds (3.0));
|
||||
|
||||
|
||||
YansWifiPhyHelper::EnablePcap ("wifi-wire-bridging", staNodes[1].Get (1));
|
||||
YansWifiPhyHelper::EnablePcap ("wifi-wire-bridging", staNodes[0].Get (0));
|
||||
YansWifiPhyHelper::EnablePcap ("wifi-wired-bridging", staNodes[1].Get (1));
|
||||
YansWifiPhyHelper::EnablePcap ("wifi-wired-bridging", staNodes[0].Get (0));
|
||||
std::ofstream os;
|
||||
os.open ("wifi-wire-bridging.mob");
|
||||
os.open ("wifi-wired-bridging.mob");
|
||||
MobilityHelper::EnableAsciiAll (os);
|
||||
|
||||
Simulator::Stop (Seconds (100.0));
|
||||
|
||||
@@ -61,6 +61,25 @@ BridgeNetDevice::BridgeNetDevice ()
|
||||
m_channel = CreateObject<BridgeChannel> ();
|
||||
}
|
||||
|
||||
BridgeNetDevice::~BridgeNetDevice()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
void
|
||||
BridgeNetDevice::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
for (std::vector< Ptr<NetDevice> >::iterator iter = m_ports.begin (); iter != m_ports.end (); iter++)
|
||||
{
|
||||
*iter = 0;
|
||||
}
|
||||
m_ports.clear ();
|
||||
m_channel = 0;
|
||||
m_node = 0;
|
||||
NetDevice::DoDispose ();
|
||||
}
|
||||
|
||||
void
|
||||
BridgeNetDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol,
|
||||
Address const &src, Address const &dst, PacketType packetType)
|
||||
@@ -421,14 +440,6 @@ BridgeNetDevice::SupportsSendFrom () const
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BridgeNetDevice::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
m_node = 0;
|
||||
NetDevice::DoDispose ();
|
||||
}
|
||||
|
||||
Address BridgeNetDevice::GetMulticast (Ipv6Address addr) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << addr);
|
||||
|
||||
@@ -68,6 +68,7 @@ class BridgeNetDevice : public NetDevice
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
BridgeNetDevice ();
|
||||
virtual ~BridgeNetDevice ();
|
||||
|
||||
/** \brief Add a 'port' to a bridge device
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user