bug 411 -- apply Raj's patch
authorraj.b@gatech.edu
Tue, 09 Dec 2008 12:24:24 -0800
changeset 3996 2277ff80158c
parent 3995 9bda1a9c0eb2
child 3997 a66553c56a8f
bug 411 -- apply Raj's patch
src/applications/onoff/onoff-application.cc
--- a/src/applications/onoff/onoff-application.cc	Tue Dec 09 12:04:36 2008 -0800
+++ b/src/applications/onoff/onoff-application.cc	Tue Dec 09 12:24:24 2008 -0800
@@ -177,13 +177,15 @@
   NS_LOG_FUNCTION_NOARGS ();
 
   ScheduleNextTx();  // Schedule the send packet event
+  ScheduleStopEvent();
 }
 
 void OnOffApplication::StopSending()
 {
   NS_LOG_FUNCTION_NOARGS ();
+  CancelEvents();
 
-  Simulator::Cancel(m_sendEvent);
+  ScheduleStartEvent();
 }
 
 // Private helpers
@@ -222,7 +224,7 @@
 
   Time onInterval = Seconds(m_onTime.GetValue());
   NS_LOG_LOGIC ("stop at " << onInterval);
-  Simulator::Schedule(onInterval, &OnOffApplication::StopSending, this);
+  m_startStopEvent = Simulator::Schedule(onInterval, &OnOffApplication::StopSending, this);
 }