diff -r dee10444d76e src/applications/onoff/onoff-application.cc --- a/src/applications/onoff/onoff-application.cc Thu Dec 04 20:19:11 2008 -0800 +++ b/src/applications/onoff/onoff-application.cc Fri Dec 05 15:56:28 2008 -0500 @@ -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); }