mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
make sure we init CongestionControl
This commit is contained in:
parent
84b8fc9f06
commit
fa6628e7eb
2 changed files with 7 additions and 2 deletions
|
@ -18,11 +18,13 @@ using namespace std::chrono;
|
|||
static const double USECS_PER_SECOND = 1000000.0;
|
||||
|
||||
void CongestionControl::setPacketSendPeriod(double newSendPeriod) {
|
||||
Q_ASSERT_X(newSendPeriod >= 0, "CongestionControl::setPacketPeriod", "Can not set a negative packet send period");
|
||||
|
||||
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);
|
||||
double minPacketSendPeriod = USECS_PER_SECOND / (((double) _maxBandwidth) / _mss);
|
||||
_packetSendPeriod = std::max(newSendPeriod, minPacketSendPeriod);
|
||||
} else {
|
||||
_packetSendPeriod = newSendPeriod;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,9 @@ Connection::Connection(Socket* parentSocket, HifiSockAddr destination, unique_pt
|
|||
{
|
||||
Q_ASSERT_X(socket, "Connection::Connection", "Must be called with a valid Socket*");
|
||||
|
||||
Q_ASSERT_X(congestionControl, "Connection::Connection", "Must be called with a valid CongestionControl object");
|
||||
congestionControl->init();
|
||||
|
||||
// setup default SYN, RTT and RTT Variance based on the SYN interval in CongestionControl object
|
||||
_synInterval = _congestionControl->synInterval();
|
||||
_rtt = _synInterval * 10;
|
||||
|
|
Loading…
Reference in a new issue