|
|
| 166 |
MakeCallback (&OnOffApplication::ConnectionSucceeded, this), |
166 |
MakeCallback (&OnOffApplication::ConnectionSucceeded, this), |
| 167 |
MakeCallback (&OnOffApplication::ConnectionFailed, this)); |
167 |
MakeCallback (&OnOffApplication::ConnectionFailed, this)); |
| 168 |
} |
168 |
} |
|
|
169 |
m_cbrRateFailSafe = m_cbrRate; |
| 170 |
|
| 169 |
// Insure no pending event |
171 |
// Insure no pending event |
| 170 |
CancelEvents (); |
172 |
CancelEvents (); |
| 171 |
// If we are not yet connected, there is nothing to do here |
173 |
// If we are not yet connected, there is nothing to do here |
|
|
| 193 |
{ |
195 |
{ |
| 194 |
NS_LOG_FUNCTION (this); |
196 |
NS_LOG_FUNCTION (this); |
| 195 |
|
197 |
|
| 196 |
if (m_sendEvent.IsRunning ()) |
198 |
if (m_sendEvent.IsRunning () && m_cbrRateFailSafe == m_cbrRate ) |
| 197 |
{ // Cancel the pending send packet event |
199 |
{ // Cancel the pending send packet event |
| 198 |
// Calculate residual bits since last packet sent |
200 |
// Calculate residual bits since last packet sent |
| 199 |
Time delta (Simulator::Now () - m_lastStartTime); |
201 |
Time delta (Simulator::Now () - m_lastStartTime); |
| 200 |
int64x64_t bits = delta.To (Time::S) * m_cbrRate.GetBitRate (); |
202 |
int64x64_t bits = delta.To (Time::S) * m_cbrRate.GetBitRate (); |
| 201 |
m_residualBits += bits.GetHigh (); |
203 |
m_residualBits += bits.GetHigh (); |
| 202 |
} |
204 |
} |
|
|
205 |
m_cbrRateFailSafe = m_cbrRate; |
| 203 |
Simulator::Cancel (m_sendEvent); |
206 |
Simulator::Cancel (m_sendEvent); |
| 204 |
Simulator::Cancel (m_startStopEvent); |
207 |
Simulator::Cancel (m_startStopEvent); |
| 205 |
} |
208 |
} |