Use Mbps for max bandwith

This commit is contained in:
Atlante45 2016-03-31 11:03:06 -07:00
parent a3b771c4dc
commit 86b425143b
3 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -354,7 +354,7 @@ void Socket::setCongestionControlFactory(std::unique_ptr<CongestionControlVirtua
void Socket::setConnectionMaxBandwidth(int maxBandwidth) {
qInfo() << "Setting socket's maximum bandwith to" << maxBandwidth << ". ("
qInfo() << "Setting socket's maximum bandwith to" << maxBandwidth << "bps. ("
<< _connectionsHash.size() << "live connections)";
_maxBandwidth = maxBandwidth;
for (auto& pair : _connectionsHash) {