mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 14:13:47 +02:00
TimeoutNAK fixes
This commit is contained in:
parent
925cb4bd56
commit
01749ad0de
3 changed files with 9 additions and 11 deletions
|
@ -285,7 +285,6 @@ bool Connection::processReceivedSequenceNumber(SequenceNumber sequenceNumber, in
|
|||
} else if (((uint32_t) sequenceNumber & 0xF) == 1) {
|
||||
_receiveWindow.onProbePair2Arrival();
|
||||
}
|
||||
|
||||
_receiveWindow.onPacketArrival();
|
||||
|
||||
// If this is not the next sequence number, report loss
|
||||
|
@ -300,19 +299,18 @@ bool Connection::processReceivedSequenceNumber(SequenceNumber sequenceNumber, in
|
|||
sendNAK(sequenceNumber);
|
||||
|
||||
// figure out when we should send the next loss report, if we haven't heard anything back
|
||||
_nakInterval = (_rtt + 4 * _rttVariance);
|
||||
_nakInterval = estimatedTimeout();
|
||||
|
||||
int receivedPacketsPerSecond = _receiveWindow.getPacketReceiveSpeed();
|
||||
|
||||
if (receivedPacketsPerSecond > 0) {
|
||||
// the NAK interval is at least the _minNAKInterval
|
||||
// but might be the time required for all lost packets to be retransmitted
|
||||
_nakInterval = std::max((int) (_lossList.getLength() * (USECS_PER_SECOND / receivedPacketsPerSecond)),
|
||||
_minNAKInterval);
|
||||
} else {
|
||||
// the NAK interval is at least the _minNAKInterval but might be the estimated timeout
|
||||
_nakInterval = std::max(estimatedTimeout(), _minNAKInterval);
|
||||
_nakInterval += (int) (_lossList.getLength() * (USECS_PER_SECOND / receivedPacketsPerSecond));
|
||||
}
|
||||
|
||||
// the NAK interval is at least the _minNAKInterval but might be the estimated timeout
|
||||
_nakInterval = std::max(_nakInterval, _minNAKInterval);
|
||||
|
||||
}
|
||||
|
||||
bool wasDuplicate = false;
|
||||
|
@ -582,7 +580,7 @@ void Connection::updateRTT(int rtt) {
|
|||
}
|
||||
|
||||
int Connection::estimatedTimeout() const {
|
||||
return _congestionControl->_userDefinedRto ? _rtt + _rttVariance * 4 : _congestionControl->_rto;
|
||||
return _congestionControl->_userDefinedRto ? _congestionControl->_rto : _rtt + _rttVariance * 4;
|
||||
}
|
||||
|
||||
void Connection::updateCongestionControlAndSendQueue(std::function<void ()> congestionCallback) {
|
||||
|
|
|
@ -81,7 +81,7 @@ void ConnectionStats::recordUnreliableReceivedPackets(int payload, int total) {
|
|||
}
|
||||
|
||||
static const double EWMA_CURRENT_SAMPLE_WEIGHT = 0.125;
|
||||
static const double EWMA_PREVIOUS_SAMPLES_WEIGHT = 1 - 0.125;
|
||||
static const double EWMA_PREVIOUS_SAMPLES_WEIGHT = 1.0 - EWMA_CURRENT_SAMPLE_WEIGHT;
|
||||
|
||||
void ConnectionStats::recordSendRate(int sample) {
|
||||
_currentSample.sendRate = sample;
|
||||
|
|
|
@ -100,7 +100,7 @@ bool LossList::remove(SequenceNumber seq) {
|
|||
} else {
|
||||
auto temp = it->second;
|
||||
it->second = seq - 1;
|
||||
it = _lossList.insert(++it, make_pair(seq + 1, temp));
|
||||
_lossList.insert(++it, make_pair(seq + 1, temp));
|
||||
}
|
||||
_length -= 1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue