mirror of
https://github.com/overte-org/overte.git
synced 2025-07-16 01:16:43 +02:00
Add max bandwidth setting
This commit is contained in:
parent
6d2498b4f2
commit
d5f6ca5e1c
2 changed files with 21 additions and 0 deletions
|
@ -77,6 +77,18 @@ void AssetServer::completeSetup() {
|
||||||
|
|
||||||
auto assetServerObject = settingsObject[ASSET_SERVER_SETTINGS_KEY].toObject();
|
auto assetServerObject = settingsObject[ASSET_SERVER_SETTINGS_KEY].toObject();
|
||||||
|
|
||||||
|
static const QString MAX_BANDWIDTH_OPTION = "max_bandwidth";
|
||||||
|
auto maxBandwidthValue = assetServerObject[MAX_BANDWIDTH_OPTION];
|
||||||
|
auto maxBandwidthFloat = maxBandwidthValue.toDouble(-1);
|
||||||
|
|
||||||
|
if (maxBandwidthFloat > 0.0) {
|
||||||
|
const int BYTES_PER_MEGABITS = (1024 * 1024) / 8;
|
||||||
|
int maxBandwidth = maxBandwidthFloat * BYTES_PER_MEGABITS;
|
||||||
|
nodeList->setConnectionMaxBandwidth(maxBandwidth);
|
||||||
|
qInfo() << "Set maximum bandwith per connection to" << maxBandwidthFloat << "Mb/s."
|
||||||
|
" (" << maxBandwidth << "bytes/sec)";
|
||||||
|
}
|
||||||
|
|
||||||
// get the path to the asset folder from the domain server settings
|
// get the path to the asset folder from the domain server settings
|
||||||
static const QString ASSETS_PATH_OPTION = "assets_path";
|
static const QString ASSETS_PATH_OPTION = "assets_path";
|
||||||
auto assetsJSONValue = assetServerObject[ASSETS_PATH_OPTION];
|
auto assetsJSONValue = assetServerObject[ASSETS_PATH_OPTION];
|
||||||
|
|
|
@ -186,6 +186,15 @@
|
||||||
"help": "The path to the directory assets are stored in.<br/>If this path is relative, it will be relative to the application data directory.<br/>If you change this path you will need to manually copy any existing assets from the previous directory.",
|
"help": "The path to the directory assets are stored in.<br/>If this path is relative, it will be relative to the application data directory.<br/>If you change this path you will need to manually copy any existing assets from the previous directory.",
|
||||||
"default": "",
|
"default": "",
|
||||||
"advanced": true
|
"advanced": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "max_bandwidth",
|
||||||
|
"type": "double",
|
||||||
|
"label": "Max Bandwidth Per User",
|
||||||
|
"help": "The maximum upstream bandwidth each user can use (in Mb/s).",
|
||||||
|
"placeholder": "10.0",
|
||||||
|
"default": "",
|
||||||
|
"advanced": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue