mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:10:40 +02:00
Merge pull request #7354 from birarda/udt-slow-start
fix for UDT slow start phase with handshake changes
This commit is contained in:
commit
e54d5aa162
3 changed files with 14 additions and 8 deletions
|
@ -34,7 +34,6 @@ void CongestionControl::setPacketSendPeriod(double newSendPeriod) {
|
|||
}
|
||||
|
||||
DefaultCC::DefaultCC() :
|
||||
_slowStartLastAck(_sendCurrSeqNum),
|
||||
_lastDecreaseMaxSeq(SequenceNumber {SequenceNumber::MAX })
|
||||
{
|
||||
_mss = udt::MAX_PACKET_SIZE_WITH_UDP_HEADER;
|
||||
|
@ -63,10 +62,10 @@ void DefaultCC::onACK(SequenceNumber ackNum) {
|
|||
|
||||
if (_slowStart) {
|
||||
// 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
|
||||
_slowStartLastAck = ackNum;
|
||||
_slowStartLastACK = ackNum;
|
||||
|
||||
// check if we can get out of slow start (is our new congestion window size bigger than the max)
|
||||
if (_congestionWindowSize > _maxCongestionWindowSize) {
|
||||
|
|
|
@ -50,6 +50,7 @@ protected:
|
|||
void setMaxCongestionWindowSize(int window) { _maxCongestionWindowSize = window; }
|
||||
void setBandwidth(int bandwidth) { _bandwidth = bandwidth; }
|
||||
void setMaxBandwidth(int maxBandwidth) { _maxBandwidth = maxBandwidth; }
|
||||
virtual void setInitialSendSequenceNumber(SequenceNumber seqNum) = 0;
|
||||
void setSendCurrentSequenceNumber(SequenceNumber seqNum) { _sendCurrSeqNum = seqNum; }
|
||||
void setReceiveRate(int rate) { _receiveRate = rate; }
|
||||
void setRTT(int rtt) { _rtt = rtt; }
|
||||
|
@ -105,13 +106,16 @@ public:
|
|||
virtual void onLoss(SequenceNumber rangeStart, SequenceNumber rangeEnd);
|
||||
virtual void onTimeout();
|
||||
|
||||
protected:
|
||||
virtual void setInitialSendSequenceNumber(SequenceNumber seqNum) { _slowStartLastACK = seqNum; }
|
||||
|
||||
private:
|
||||
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
|
||||
|
||||
bool _slowStart { true }; // if in slow start phase
|
||||
SequenceNumber _slowStartLastAck; // last ACKed seq num
|
||||
SequenceNumber _slowStartLastACK; // last ACKed seq num from previous slow start check
|
||||
bool _loss { false }; // if loss happened since last rate increase
|
||||
SequenceNumber _lastDecreaseMaxSeq; // max pkt seq num sent out 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->setEstimatedTimeout(estimatedTimeout());
|
||||
_sendQueue->setFlowWindowSize(std::min(_flowWindowSize, (int) _congestionControl->_congestionWindowSize));
|
||||
|
||||
// give the randomized sequence number to the congestion control object
|
||||
_congestionControl->setInitialSendSequenceNumber(_sendQueue->getCurrentSequenceNumber());
|
||||
}
|
||||
|
||||
return *_sendQueue;
|
||||
|
|
Loading…
Reference in a new issue