diff --git a/libraries/networking/src/udt/TCPRenoCC.cpp b/libraries/networking/src/udt/TCPRenoCC.cpp index 7f83601354..85f120bd50 100644 --- a/libraries/networking/src/udt/TCPRenoCC.cpp +++ b/libraries/networking/src/udt/TCPRenoCC.cpp @@ -35,7 +35,7 @@ bool TCPRenoCC::isInSlowStart() { return _sendCongestionWindowSize < _sendSlowStartThreshold; } -int TCPRenoCC::slowStart(int numAcked) { +int TCPRenoCC::performSlowStart(int numAcked) { int congestionWindow = std::min(_sendCongestionWindowSize + numAcked, _sendSlowStartThreshold); numAcked -= congestionWindow - _sendCongestionWindowSize; _sendCongestionWindowSize = std::min(congestionWindow, _sendCongestionWindowClamp); @@ -63,7 +63,7 @@ void TCPRenoCC::performCongestionAvoidance(SequenceNumber ack, int numAcked) { // In "safe" area, increase. if (isInSlowStart()) { - numAcked = slowStart(numAcked); + numAcked = performSlowStart(numAcked); if (!numAcked) { return; } diff --git a/libraries/networking/src/udt/TCPRenoCC.h b/libraries/networking/src/udt/TCPRenoCC.h index 71c32b3a48..da54dc9a6b 100644 --- a/libraries/networking/src/udt/TCPRenoCC.h +++ b/libraries/networking/src/udt/TCPRenoCC.h @@ -25,7 +25,7 @@ protected: virtual void setInitialSendSequenceNumber(SequenceNumber seqNum) { _lastACK = seqNum - 1; } bool isInSlowStart(); - int slowStart(int numAcked); + int performSlowStart(int numAcked); int slowStartThreshold(); bool isCongestionWindowLimited(); diff --git a/libraries/networking/src/udt/TCPVegasCC.cpp b/libraries/networking/src/udt/TCPVegasCC.cpp index 4e716c4d1c..b76fe91b43 100644 --- a/libraries/networking/src/udt/TCPVegasCC.cpp +++ b/libraries/networking/src/udt/TCPVegasCC.cpp @@ -55,7 +55,7 @@ void TCPVegasCC::onACK(SequenceNumber ackNum) { } } -void TCPVegasCC::performCongestionAvoidance(udt::SequenceNumber ack, int numACK) { +void TCPVegasCC::performCongestionAvoidance(udt::SequenceNumber ack, int numAcked) { static int VEGAS_MIN_RTT_FOR_CALC = 3; static uint64_t VEGAS_ALPHA_SEGMENTS = 2; @@ -67,7 +67,7 @@ void TCPVegasCC::performCongestionAvoidance(udt::SequenceNumber ack, int numACK) // pretty sure that at least one sample did not come from a delayed ACK. // If that is the case, we fallback to the Reno behaviour - TCPRenoCC::performCongestionAvoidance(ack, numACK); + TCPRenoCC::performCongestionAvoidance(ack, numAcked); } else { // There are enough RTT samples, use the Vegas algorithm to see if we should // increase or decrease the congestion window size, and by how much @@ -92,7 +92,7 @@ void TCPVegasCC::performCongestionAvoidance(udt::SequenceNumber ack, int numACK) inWindowReduction = true; } else if (isInSlowStart()) { // slow start - performSlowStart(ack); + performSlowStart(numAcked); } else { // figure out where the congestion window should be if (diff > VEGAS_BETA_SEGMENTS) { @@ -114,11 +114,11 @@ void TCPVegasCC::performCongestionAvoidance(udt::SequenceNumber ack, int numACK) static uint64_t VEGAS_CW_MIN_PACKETS = 2; _congestionWindowSize = std::min(_congestionWindowSize, VEGAS_CW_MIN_PACKETS); - if (!inWindowReduction && _congestionWindowSize > _slowStartThreshold) { + if (!inWindowReduction && _congestionWindowSize > _sendSlowStartThreshold) { // if we didn't just reduce the congestion window size and the // the congestion window is greater than the slow start threshold // we raise the slow start threshold half the distance to the congestion window - _slowStartThreshold = (_congestionWindowSize >> 1) + (_congestionWindowSize >> 2); + _sendSlowStartThreshold = (_congestionWindowSize >> 1) + (_congestionWindowSize >> 2); } _lastRTTMaxSeqNum = _sendCurrSeqNum; diff --git a/libraries/networking/src/udt/TCPVegasCC.h b/libraries/networking/src/udt/TCPVegasCC.h index 634262423a..112a53338a 100644 --- a/libraries/networking/src/udt/TCPVegasCC.h +++ b/libraries/networking/src/udt/TCPVegasCC.h @@ -34,10 +34,10 @@ public: virtual void onPacketSent(int packetSize, SequenceNumber seqNum) override; protected: - virtual void performCongestionAvoidance(SequenceNumber ack, int numACK) override; + virtual void performCongestionAvoidance(SequenceNumber ack, int numAcked) override; private: void adjustSlowStartThreshold() - { _slowStartThreshold = std::min(_slowStartThreshold, (uint32_t) _congestionWindowSize - 1); } + { _sendSlowStartThreshold = std::min(_sendSlowStartThreshold, (int) _congestionWindowSize - 1); } using TimeSizePair = std::pair; using PacketTimeList = std::map;