mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 04:53:25 +02:00
fix for slow start initial value with new randomization
This commit is contained in:
parent
c6de24f953
commit
7858b6b0cd
3 changed files with 15 additions and 8 deletions
|
@ -34,7 +34,6 @@ void CongestionControl::setPacketSendPeriod(double newSendPeriod) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultCC::DefaultCC() :
|
DefaultCC::DefaultCC() :
|
||||||
_slowStartLastAck(_sendCurrSeqNum),
|
|
||||||
_lastDecreaseMaxSeq(SequenceNumber {SequenceNumber::MAX })
|
_lastDecreaseMaxSeq(SequenceNumber {SequenceNumber::MAX })
|
||||||
{
|
{
|
||||||
_mss = udt::MAX_PACKET_SIZE_WITH_UDP_HEADER;
|
_mss = udt::MAX_PACKET_SIZE_WITH_UDP_HEADER;
|
||||||
|
@ -63,10 +62,10 @@ void DefaultCC::onACK(SequenceNumber ackNum) {
|
||||||
|
|
||||||
if (_slowStart) {
|
if (_slowStart) {
|
||||||
// we are in slow start phase - increase the congestion window size by the number of packets just ACKed
|
// we are in slow start phase - increase the congestion window size by the number of packets just ACKed
|
||||||
_congestionWindowSize += seqlen(_slowStartLastAck, ackNum);
|
_congestionWindowSize += seqlen(_slowStartLastACK, ackNum);
|
||||||
|
|
||||||
// update the last ACK
|
// update the last ACK
|
||||||
_slowStartLastAck = ackNum;
|
_slowStartLastACK = ackNum;
|
||||||
|
|
||||||
// check if we can get out of slow start (is our new congestion window size bigger than the max)
|
// check if we can get out of slow start (is our new congestion window size bigger than the max)
|
||||||
if (_congestionWindowSize > _maxCongestionWindowSize) {
|
if (_congestionWindowSize > _maxCongestionWindowSize) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ protected:
|
||||||
void setMaxCongestionWindowSize(int window) { _maxCongestionWindowSize = window; }
|
void setMaxCongestionWindowSize(int window) { _maxCongestionWindowSize = window; }
|
||||||
void setBandwidth(int bandwidth) { _bandwidth = bandwidth; }
|
void setBandwidth(int bandwidth) { _bandwidth = bandwidth; }
|
||||||
void setMaxBandwidth(int maxBandwidth) { _maxBandwidth = maxBandwidth; }
|
void setMaxBandwidth(int maxBandwidth) { _maxBandwidth = maxBandwidth; }
|
||||||
|
virtual void setInitialSendSequenceNumber(SequenceNumber seqNum) = 0;
|
||||||
void setSendCurrentSequenceNumber(SequenceNumber seqNum) { _sendCurrSeqNum = seqNum; }
|
void setSendCurrentSequenceNumber(SequenceNumber seqNum) { _sendCurrSeqNum = seqNum; }
|
||||||
void setReceiveRate(int rate) { _receiveRate = rate; }
|
void setReceiveRate(int rate) { _receiveRate = rate; }
|
||||||
void setRTT(int rtt) { _rtt = rtt; }
|
void setRTT(int rtt) { _rtt = rtt; }
|
||||||
|
@ -105,13 +106,17 @@ public:
|
||||||
virtual void onLoss(SequenceNumber rangeStart, SequenceNumber rangeEnd);
|
virtual void onLoss(SequenceNumber rangeStart, SequenceNumber rangeEnd);
|
||||||
virtual void onTimeout();
|
virtual void onTimeout();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void setInitialSendSequenceNumber(SequenceNumber seqNum) { _slowStartLastACK = seqNum; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void stopSlowStart(); // stops the slow start on loss or timeout
|
void stopSlowStart(); // stops the slow start on loss or timeout
|
||||||
|
|
||||||
p_high_resolution_clock::time_point _lastRCTime = p_high_resolution_clock::now(); // last rate increase time
|
p_high_resolution_clock::time_point _lastRCTime = p_high_resolution_clock::now(); // last rate increase time
|
||||||
|
|
||||||
bool _slowStart { true }; // if in slow start phase
|
bool _slowStart { true }; // if in slow start phase
|
||||||
SequenceNumber _slowStartLastAck; // last ACKed seq num
|
bool _hasSetSlowStartACK { false }; // flag to signal if slow start ACK has been set with handshake sequence number
|
||||||
|
SequenceNumber _slowStartLastACK; // last ACKed seq num from previous slow start check
|
||||||
bool _loss { false }; // if loss happened since last rate increase
|
bool _loss { false }; // if loss happened since last rate increase
|
||||||
SequenceNumber _lastDecreaseMaxSeq; // max pkt seq num sent out when last decrease happened
|
SequenceNumber _lastDecreaseMaxSeq; // max pkt seq num sent out when last decrease happened
|
||||||
double _lastDecreasePeriod { 1 }; // value of _packetSendPeriod when last decrease happened
|
double _lastDecreasePeriod { 1 }; // value of _packetSendPeriod when last decrease happened
|
||||||
|
|
|
@ -104,6 +104,9 @@ SendQueue& Connection::getSendQueue() {
|
||||||
_sendQueue->setSyncInterval(_synInterval);
|
_sendQueue->setSyncInterval(_synInterval);
|
||||||
_sendQueue->setEstimatedTimeout(estimatedTimeout());
|
_sendQueue->setEstimatedTimeout(estimatedTimeout());
|
||||||
_sendQueue->setFlowWindowSize(std::min(_flowWindowSize, (int) _congestionControl->_congestionWindowSize));
|
_sendQueue->setFlowWindowSize(std::min(_flowWindowSize, (int) _congestionControl->_congestionWindowSize));
|
||||||
|
|
||||||
|
// give the randomized sequence number to the congestion control object
|
||||||
|
_congestionControl->setInitialSendSequenceNumber(_sendQueue->getCurrentSequenceNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
return *_sendQueue;
|
return *_sendQueue;
|
||||||
|
|
Loading…
Reference in a new issue