Bug 1798 - Changing the rate of onOffApplication might stop transmission
This commit is contained in:
@@ -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
|
||||
==============
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ private:
|
||||
Ptr<RandomVariableStream> m_onTime; // rng for On Time
|
||||
Ptr<RandomVariableStream> 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
|
||||
|
||||
Reference in New Issue
Block a user