do not leak the channel from simple-p2p
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Wed, 02 May 2007 11:43:22 +0200
changeset 480 7cf532738f61
parent 479 eefc92272862
child 481 508960b83d20
do not leak the channel from simple-p2p
examples/simple-p2p.cc
--- a/examples/simple-p2p.cc	Wed May 02 11:38:21 2007 +0200
+++ b/examples/simple-p2p.cc	Wed May 02 11:43:22 2007 +0200
@@ -104,20 +104,26 @@
   Node* n2 = Node::Create(); 
   Node* n3 = Node::Create(); 
 
-  PointToPointTopology::AddPointToPointLink (
+  PointToPointChannel *channel0 = 
+    PointToPointTopology::AddPointToPointLink (
       n0, Ipv4Address("10.1.1.1"), 
       n2, Ipv4Address("10.1.1.2"), 
       DataRate(5000000), MilliSeconds(2));
+  channel0->Unref ();
   
-  PointToPointTopology::AddPointToPointLink (
+  PointToPointChannel *channel1 = 
+    PointToPointTopology::AddPointToPointLink (
       n1, Ipv4Address("10.1.2.1"), 
       n2, Ipv4Address("10.1.2.2"), 
       DataRate(5000000), MilliSeconds(2));
+  channel1->Unref ();
 
-  PointToPointTopology::AddPointToPointLink (
+  PointToPointChannel *channel2 = 
+    PointToPointTopology::AddPointToPointLink (
       n2, Ipv4Address("10.1.3.1"), 
       n3, Ipv4Address("10.1.3.2"), 
       DataRate(1500000), MilliSeconds(10));
+  channel2->Unref ();
   
   // Create the OnOff application to send UDP datagrams of size
   // 210 bytes at a rate of 448 Kb/s