diff --git a/libraries/networking/src/udt/TCPVegasCC.cpp b/libraries/networking/src/udt/TCPVegasCC.cpp index b9654aa0f0..39680d1059 100644 --- a/libraries/networking/src/udt/TCPVegasCC.cpp +++ b/libraries/networking/src/udt/TCPVegasCC.cpp @@ -113,18 +113,20 @@ void TCPVegasCC::performCongestionAvoidance(udt::SequenceNumber ack) { // (though congestion may be noticed a bit later) int rtt = _currentMinRTT; - int expectedWindowSize = _congestionWindowSize * _baseRTT / rtt; int windowSizeDiff = _congestionWindowSize * (rtt - _baseRTT) / _baseRTT; - qDebug() << "BRTT:" << _baseRTT << "CRTT:" << _currentMinRTT; + qDebug() << "BRTT:" << _baseRTT << "CRTT:" << _currentMinRTT << "ERTT:" << _ewmaRTT; qDebug() << "D:" << windowSizeDiff; - if (_slowStart) { if (windowSizeDiff > VEGAS_GAMMA_SEGMENTS) { // we're going too fast - this breaks us out of slow start and we switch to linear increase/decrease _slowStart = false; + int expectedWindowSize = _congestionWindowSize * _baseRTT / rtt; + + qDebug() << "EWS:" << expectedWindowSize; + // drop the congestion window size to the expected size, if smaller _congestionWindowSize = std::min(_congestionWindowSize, expectedWindowSize + 1); diff --git a/libraries/networking/src/udt/TCPVegasCC.h b/libraries/networking/src/udt/TCPVegasCC.h index a1145ddd3d..d7d884fc4b 100644 --- a/libraries/networking/src/udt/TCPVegasCC.h +++ b/libraries/networking/src/udt/TCPVegasCC.h @@ -55,8 +55,8 @@ private: int _currentMinRTT { 0x7FFFFFFF }; // Current RTT, in microseconds int _baseRTT { 0x7FFFFFFF }; // Lowest RTT during connection, in microseconds int _numRTT { 0 }; // Number of RTT collected during last RTT - int _ewmaRTT { 0 }; // Exponential weighted moving average RTT - int _rttVariance { 0 }; // Variance in collected RTT values + int _ewmaRTT { 100000 }; // Exponential weighted moving average RTT + int _rttVariance { 50000 }; // Variance in collected RTT values int _slowStartOddAdjust { 0 }; // Marker for every window adjustment every other RTT in slow-start