mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 19:13:38 +02:00
make packet send period update respect max bandwidth
This commit is contained in:
parent
0ea1bb578f
commit
c2d39f0f6a
2 changed files with 13 additions and 9 deletions
|
@ -17,6 +17,17 @@ using namespace std::chrono;
|
|||
|
||||
static const double USECS_PER_SECOND = 1000000.0;
|
||||
|
||||
void CongestionControl::setPacketSendPeriod(double newSendPeriod) {
|
||||
if (_maxBandwidth > 0) {
|
||||
// anytime the packet send period is about to be increased, make sure it stays below the minimum period,
|
||||
// calculated based on the maximum desired bandwidth
|
||||
int minPacketSendPeriod = USECS_PER_SECOND / (double(_maxBandwidth) / _mss);
|
||||
_packetSendPeriod = std::max(newSendPeriod, (double) minPacketSendPeriod);
|
||||
} else {
|
||||
_packetSendPeriod = newSendPeriod;
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultCC::init() {
|
||||
_lastRCTime = high_resolution_clock::now();
|
||||
|
||||
|
@ -111,15 +122,7 @@ void DefaultCC::onACK(SequenceNumber ackNum) {
|
|||
}
|
||||
}
|
||||
|
||||
_packetSendPeriod = (_packetSendPeriod * synInterval()) / (_packetSendPeriod * increase + synInterval());
|
||||
|
||||
if (_maxBandwidth > 0) {
|
||||
// anytime the packet send period is about to be increased, make sure it stays below the minimum period,
|
||||
// calculated based on the maximum desired bandwidth
|
||||
int minPacketSendPeriod = USECS_PER_SECOND / (double(_maxBandwidth) / _mss);
|
||||
_packetSendPeriod = std::max(_packetSendPeriod, (double) minPacketSendPeriod);
|
||||
}
|
||||
|
||||
setPacketSendPeriod((_packetSendPeriod * synInterval()) / (_packetSendPeriod * increase + synInterval()));
|
||||
}
|
||||
|
||||
void DefaultCC::onLoss(SequenceNumber rangeStart, SequenceNumber rangeEnd) {
|
||||
|
|
|
@ -51,6 +51,7 @@ protected:
|
|||
void setSendCurrentSequenceNumber(SequenceNumber seqNum) { _sendCurrSeqNum = seqNum; }
|
||||
void setReceiveRate(int rate) { _receiveRate = rate; }
|
||||
void setRTT(int rtt) { _rtt = rtt; }
|
||||
void setPacketSendPeriod(double newSendPeriod); // call this internally to ensure send period doesn't go past max bandwidth
|
||||
|
||||
double _packetSendPeriod { 1.0 }; // Packet sending period, in microseconds
|
||||
double _congestionWindowSize { 16.0 }; // Congestion window size, in packets
|
||||
|
|
Loading…
Reference in a new issue