mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 00:13:29 +02:00
Merge pull request #5951 from huffman/cc-rng-fix
Fix infinite recursion error with CC rng
This commit is contained in:
commit
46e1a298c8
1 changed files with 10 additions and 7 deletions
|
@ -161,13 +161,16 @@ void DefaultCC::onLoss(SequenceNumber rangeStart, SequenceNumber rangeEnd) {
|
||||||
|
|
||||||
_lastDecreaseMaxSeq = _sendCurrSeqNum;
|
_lastDecreaseMaxSeq = _sendCurrSeqNum;
|
||||||
|
|
||||||
// avoid synchronous rate decrease across connections using randomization
|
if (_avgNAKNum < 1) {
|
||||||
std::random_device rd;
|
_randomDecreaseThreshold = 1;
|
||||||
std::mt19937 generator(rd());
|
} else {
|
||||||
std::uniform_int_distribution<> distribution(1, _avgNAKNum);
|
// avoid synchronous rate decrease across connections using randomization
|
||||||
|
std::random_device rd;
|
||||||
_randomDecreaseThreshold = distribution(generator);
|
std::mt19937 generator(rd());
|
||||||
|
std::uniform_int_distribution<> distribution(1, std::max(1, _avgNAKNum));
|
||||||
|
|
||||||
|
_randomDecreaseThreshold = distribution(generator);
|
||||||
|
}
|
||||||
} else if ((_decreaseCount++ < MAX_DECREASES_PER_CONGESTION_EPOCH) && ((++_nakCount % _randomDecreaseThreshold) == 0)) {
|
} else if ((_decreaseCount++ < MAX_DECREASES_PER_CONGESTION_EPOCH) && ((++_nakCount % _randomDecreaseThreshold) == 0)) {
|
||||||
// there have been fewer than MAX_DECREASES_PER_CONGESTION_EPOCH AND this NAK matches the random count at which we
|
// there have been fewer than MAX_DECREASES_PER_CONGESTION_EPOCH AND this NAK matches the random count at which we
|
||||||
// decided we would decrease the packet send period
|
// decided we would decrease the packet send period
|
||||||
|
|
Loading…
Reference in a new issue