mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:08:54 +02:00
point TCPVegasCC at correct TCPRenoCC base
This commit is contained in:
parent
8c9b46c1e0
commit
69ca0d2675
4 changed files with 10 additions and 10 deletions
|
@ -35,7 +35,7 @@ bool TCPRenoCC::isInSlowStart() {
|
||||||
return _sendCongestionWindowSize < _sendSlowStartThreshold;
|
return _sendCongestionWindowSize < _sendSlowStartThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TCPRenoCC::slowStart(int numAcked) {
|
int TCPRenoCC::performSlowStart(int numAcked) {
|
||||||
int congestionWindow = std::min(_sendCongestionWindowSize + numAcked, _sendSlowStartThreshold);
|
int congestionWindow = std::min(_sendCongestionWindowSize + numAcked, _sendSlowStartThreshold);
|
||||||
numAcked -= congestionWindow - _sendCongestionWindowSize;
|
numAcked -= congestionWindow - _sendCongestionWindowSize;
|
||||||
_sendCongestionWindowSize = std::min(congestionWindow, _sendCongestionWindowClamp);
|
_sendCongestionWindowSize = std::min(congestionWindow, _sendCongestionWindowClamp);
|
||||||
|
@ -63,7 +63,7 @@ void TCPRenoCC::performCongestionAvoidance(SequenceNumber ack, int numAcked) {
|
||||||
|
|
||||||
// In "safe" area, increase.
|
// In "safe" area, increase.
|
||||||
if (isInSlowStart()) {
|
if (isInSlowStart()) {
|
||||||
numAcked = slowStart(numAcked);
|
numAcked = performSlowStart(numAcked);
|
||||||
if (!numAcked) {
|
if (!numAcked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ protected:
|
||||||
virtual void setInitialSendSequenceNumber(SequenceNumber seqNum) { _lastACK = seqNum - 1; }
|
virtual void setInitialSendSequenceNumber(SequenceNumber seqNum) { _lastACK = seqNum - 1; }
|
||||||
|
|
||||||
bool isInSlowStart();
|
bool isInSlowStart();
|
||||||
int slowStart(int numAcked);
|
int performSlowStart(int numAcked);
|
||||||
int slowStartThreshold();
|
int slowStartThreshold();
|
||||||
|
|
||||||
bool isCongestionWindowLimited();
|
bool isCongestionWindowLimited();
|
||||||
|
|
|
@ -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 int VEGAS_MIN_RTT_FOR_CALC = 3;
|
||||||
|
|
||||||
static uint64_t VEGAS_ALPHA_SEGMENTS = 2;
|
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.
|
// 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
|
// If that is the case, we fallback to the Reno behaviour
|
||||||
|
|
||||||
TCPRenoCC::performCongestionAvoidance(ack, numACK);
|
TCPRenoCC::performCongestionAvoidance(ack, numAcked);
|
||||||
} else {
|
} else {
|
||||||
// There are enough RTT samples, use the Vegas algorithm to see if we should
|
// 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
|
// 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;
|
inWindowReduction = true;
|
||||||
} else if (isInSlowStart()) {
|
} else if (isInSlowStart()) {
|
||||||
// slow start
|
// slow start
|
||||||
performSlowStart(ack);
|
performSlowStart(numAcked);
|
||||||
} else {
|
} else {
|
||||||
// figure out where the congestion window should be
|
// figure out where the congestion window should be
|
||||||
if (diff > VEGAS_BETA_SEGMENTS) {
|
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;
|
static uint64_t VEGAS_CW_MIN_PACKETS = 2;
|
||||||
_congestionWindowSize = std::min(_congestionWindowSize, VEGAS_CW_MIN_PACKETS);
|
_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
|
// if we didn't just reduce the congestion window size and the
|
||||||
// the congestion window is greater than the slow start threshold
|
// the congestion window is greater than the slow start threshold
|
||||||
// we raise the slow start threshold half the distance to the congestion window
|
// 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;
|
_lastRTTMaxSeqNum = _sendCurrSeqNum;
|
||||||
|
|
|
@ -34,10 +34,10 @@ public:
|
||||||
virtual void onPacketSent(int packetSize, SequenceNumber seqNum) override;
|
virtual void onPacketSent(int packetSize, SequenceNumber seqNum) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void performCongestionAvoidance(SequenceNumber ack, int numACK) override;
|
virtual void performCongestionAvoidance(SequenceNumber ack, int numAcked) override;
|
||||||
private:
|
private:
|
||||||
void adjustSlowStartThreshold()
|
void adjustSlowStartThreshold()
|
||||||
{ _slowStartThreshold = std::min(_slowStartThreshold, (uint32_t) _congestionWindowSize - 1); }
|
{ _sendSlowStartThreshold = std::min(_sendSlowStartThreshold, (int) _congestionWindowSize - 1); }
|
||||||
|
|
||||||
using TimeSizePair = std::pair<p_high_resolution_clock::time_point, int>;
|
using TimeSizePair = std::pair<p_high_resolution_clock::time_point, int>;
|
||||||
using PacketTimeList = std::map<SequenceNumber, TimeSizePair>;
|
using PacketTimeList = std::map<SequenceNumber, TimeSizePair>;
|
||||||
|
|
Loading…
Reference in a new issue