diff --git a/RELEASE_NOTES b/RELEASE_NOTES index d34f82d32..12e8272ca 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -27,6 +27,7 @@ Bugs fixed - Bug 1778 - Implement TapBridge::IsLinkUp() function - Bug 1777 - Implement the more direct way of "using" configuration of existing tap interface - Bug 1776 - Improve CRC performance for CsmaNetDevice in emulation modes +- Bug 1798 - Changing the rate of onOffApplication might stop transmission Release 3.18.1 ============== diff --git a/src/applications/model/onoff-application.cc b/src/applications/model/onoff-application.cc index c6414d702..716837fc7 100644 --- a/src/applications/model/onoff-application.cc +++ b/src/applications/model/onoff-application.cc @@ -167,6 +167,8 @@ void OnOffApplication::StartApplication () // Called at time specified by Start MakeCallback (&OnOffApplication::ConnectionSucceeded, this), MakeCallback (&OnOffApplication::ConnectionFailed, this)); } + m_cbrRateFailSafe = m_cbrRate; + // Insure no pending event CancelEvents (); // If we are not yet connected, there is nothing to do here @@ -194,13 +196,14 @@ void OnOffApplication::CancelEvents () { NS_LOG_FUNCTION (this); - if (m_sendEvent.IsRunning ()) + if (m_sendEvent.IsRunning () && m_cbrRateFailSafe == m_cbrRate ) { // Cancel the pending send packet event // Calculate residual bits since last packet sent Time delta (Simulator::Now () - m_lastStartTime); int64x64_t bits = delta.To (Time::S) * m_cbrRate.GetBitRate (); m_residualBits += bits.GetHigh (); } + m_cbrRateFailSafe = m_cbrRate; Simulator::Cancel (m_sendEvent); Simulator::Cancel (m_startStopEvent); } diff --git a/src/applications/model/onoff-application.h b/src/applications/model/onoff-application.h index ff1f9b306..9bf1eeae9 100644 --- a/src/applications/model/onoff-application.h +++ b/src/applications/model/onoff-application.h @@ -145,6 +145,7 @@ private: Ptr m_onTime; // rng for On Time Ptr m_offTime; // rng for Off Time DataRate m_cbrRate; // Rate that data is generated + DataRate m_cbrRateFailSafe; // Rate that data is generated (check copy) uint32_t m_pktSize; // Size of packets uint32_t m_residualBits; // Number of generated, but not sent, bits Time m_lastStartTime; // Time last packet sent