mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
fixed possible divide by zero error in setpacketsendperiod in CongestionControl.cpp
This commit is contained in:
parent
75b6705f19
commit
ced5f52971
1 changed files with 1 additions and 1 deletions
|
@ -29,7 +29,7 @@ void CongestionControl::setMaxBandwidth(int maxBandwidth) {
|
||||||
void CongestionControl::setPacketSendPeriod(double newSendPeriod) {
|
void CongestionControl::setPacketSendPeriod(double newSendPeriod) {
|
||||||
Q_ASSERT_X(newSendPeriod >= 0, "CongestionControl::setPacketPeriod", "Can not set a negative packet send period");
|
Q_ASSERT_X(newSendPeriod >= 0, "CongestionControl::setPacketPeriod", "Can not set a negative packet send period");
|
||||||
|
|
||||||
auto packetsPerSecond = (double)_maxBandwidth / (BITS_PER_BYTE * _mss);
|
auto packetsPerSecond = _mss > 0.0f ? (double)_maxBandwidth / (BITS_PER_BYTE * _mss) : -1.0f;
|
||||||
if (packetsPerSecond > 0.0) {
|
if (packetsPerSecond > 0.0) {
|
||||||
// anytime the packet send period is about to be increased, make sure it stays below the minimum period,
|
// 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
|
// calculated based on the maximum desired bandwidth
|
||||||
|
|
Loading…
Reference in a new issue