--- a/src/applications/onoff/onoff-application.cc Fri Aug 15 11:25:18 2008 -0400
+++ b/src/applications/onoff/onoff-application.cc Fri Aug 15 12:58:53 2008 -0400
@@ -135,7 +135,7 @@
m_socket->Connect (m_peer);
}
// Insure no pending event
- StopApplication();
+ CancelEvents ();
// If we are not yet connected, there is nothing to do here
// The ConnectionComplete upcall will start timers at that time
//if (!m_connected) return;
@@ -146,6 +146,14 @@
{
NS_LOG_FUNCTION_NOARGS ();
+ CancelEvents ();
+ m_socket->Close ();
+}
+
+void OnOffApplication::CancelEvents ()
+{
+ NS_LOG_FUNCTION_NOARGS ();
+
if (m_sendEvent.IsRunning ())
{ // Cancel the pending send packet event
// Calculate residual bits since last packet sent
--- a/src/applications/onoff/onoff-application.h Fri Aug 15 11:25:18 2008 -0400
+++ b/src/applications/onoff/onoff-application.h Fri Aug 15 12:58:53 2008 -0400
@@ -83,6 +83,9 @@
virtual void StartApplication (void); // Called at time specified by Start
virtual void StopApplication (void); // Called at time specified by Stop
+ //helpers
+ void CancelEvents ();
+
void Construct (Ptr<Node> n,
const Address &remote,
std::string tid,