Bugzilla – Bug 2587
Function named UpdateBeta is wrong in tcp-htcp.cc file
Last modified: 2017-02-06 07:23:44 UTC
First of all, m_throughput's type is uint32. And, if m_lastThroughput is greater than m_throughput, the result of '((m_throughput - m_lastThroughput) / m_lastThroughput)' should be negative value like following algorithm. if (((m_throughput - m_lastThroughput) / m_lastThroughput) > m_throughputRatio) { m_beta = m_defaultBackoff; } else { m_beta = m_minRtt.GetDouble () / m_maxRtt.GetDouble (); } But! since m_throughput's type is uint32, overflow is occurred. So, m_beta's value will be mostly m_defaultBackoff. Finally we suggest change algorithm like that if((m_throughput - m_lastThroughput) > 0) { if (((m_throughput - m_lastThroughput) / m_lastThroughput) > m_throughputRatio) { m_beta = m_defaultBackoff; } } else { m_beta = m_minRtt.GetDouble () / m_maxRtt.GetDouble (); }
Created attachment 2776 [details] Corrected patch Hi, Your patch still present a problem of overflow because of the fact that uint32 - uint32 is always > 0 (as you said, there could be overflow). The corrected behavior (IMHO) is reported in this patch. Please check.
The patch looks correct. Thank you
Committed in 12670:0c9178f1709d, thanks