From 86b425143b4de5ad619b731b310b41ff405298a6 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 31 Mar 2016 11:03:06 -0700 Subject: [PATCH] Use Mbps for max bandwith --- assignment-client/src/assets/AssetServer.cpp | 6 +++--- libraries/networking/src/udt/CongestionControl.cpp | 2 +- libraries/networking/src/udt/Socket.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assignment-client/src/assets/AssetServer.cpp b/assignment-client/src/assets/AssetServer.cpp index fad8ece7bf..0bf59eb8ad 100644 --- a/assignment-client/src/assets/AssetServer.cpp +++ b/assignment-client/src/assets/AssetServer.cpp @@ -82,11 +82,11 @@ void AssetServer::completeSetup() { auto maxBandwidthFloat = maxBandwidthValue.toDouble(-1); if (maxBandwidthFloat > 0.0) { - const int BYTES_PER_MEGABITS = (1024 * 1024) / 8; - int maxBandwidth = maxBandwidthFloat * BYTES_PER_MEGABITS; + const int BITS_PER_MEGABITS = 1000 * 1000; + int maxBandwidth = maxBandwidthFloat * BITS_PER_MEGABITS; nodeList->setConnectionMaxBandwidth(maxBandwidth); qInfo() << "Set maximum bandwith per connection to" << maxBandwidthFloat << "Mb/s." - " (" << maxBandwidth << "bytes/sec)"; + " (" << maxBandwidth << "bits/s)"; } // get the path to the asset folder from the domain server settings diff --git a/libraries/networking/src/udt/CongestionControl.cpp b/libraries/networking/src/udt/CongestionControl.cpp index a62ec072bc..e583ff7e3b 100644 --- a/libraries/networking/src/udt/CongestionControl.cpp +++ b/libraries/networking/src/udt/CongestionControl.cpp @@ -19,7 +19,7 @@ using namespace std::chrono; static const double USECS_PER_SECOND = 1000000.0; void CongestionControl::setMaxBandwidth(int maxBandwidth) { - _maxBandwidth = maxBandwidth; + _maxBandwidth = maxBandwidth / 8; setPacketSendPeriod(_packetSendPeriod); } diff --git a/libraries/networking/src/udt/Socket.cpp b/libraries/networking/src/udt/Socket.cpp index e9af1577fb..0695a65e1f 100644 --- a/libraries/networking/src/udt/Socket.cpp +++ b/libraries/networking/src/udt/Socket.cpp @@ -354,7 +354,7 @@ void Socket::setCongestionControlFactory(std::unique_ptr