tcp: (fixes #410) Fix TCP Westwood bandwidth estimation bug

This commit is contained in:
Gauri Prasad
2021-09-29 14:06:47 -07:00
committed by Tom Henderson
parent 9844819d88
commit 235732f6af
2 changed files with 11 additions and 2 deletions

View File

@@ -70,7 +70,8 @@ TcpWestwood::TcpWestwood (void) :
m_lastSampleBW (0),
m_lastBW (0),
m_ackedSegments (0),
m_IsCount (false)
m_IsCount (false),
m_lastAck (0)
{
NS_LOG_FUNCTION (this);
}
@@ -131,8 +132,15 @@ TcpWestwood::EstimateBW (const Time &rtt, Ptr<TcpSocketState> tcb)
m_currentBW = m_ackedSegments * tcb->m_segmentSize / rtt.GetSeconds ();
if (m_pType == TcpWestwood::WESTWOODPLUS)
if (m_pType == TcpWestwood::WESTWOOD)
{
Time currentAck = Simulator::Now ();
m_currentBW = m_ackedSegments * tcb->m_segmentSize / (currentAck - m_lastAck).GetSeconds ();
m_lastAck = currentAck;
}
else if (m_pType == TcpWestwood::WESTWOODPLUS)
{
m_currentBW = m_ackedSegments * tcb->m_segmentSize / rtt.GetSeconds ();
m_IsCount = false;
}

View File

@@ -133,6 +133,7 @@ protected:
uint32_t m_ackedSegments; //!< The number of segments ACKed between RTTs
bool m_IsCount; //!< Start keeping track of m_ackedSegments for Westwood+ if TRUE
EventId m_bwEstimateEvent; //!< The BW estimation event for Westwood+
Time m_lastAck; //!< The last ACK time
};