2
0
mirror of https://github.com/meganz/MEGAcmd synced 2025-08-29 12:57:44 +00:00

fix attempt to set invalid value at startup

This commit is contained in:
Pablo Martin 2025-03-20 11:09:03 +01:00
parent 045a6305d8
commit 21ea5fbbbb
No known key found for this signature in database
GPG Key ID: 1746978B12F13D6E

View File

@ -2644,12 +2644,15 @@ int MegaCmdExecuter::actUponLogin(SynchronousRequestListener *srl, int timeout)
{ {
auto megaCmdListener = std::make_unique<MegaCmdListener>(nullptr); auto megaCmdListener = std::make_unique<MegaCmdListener>(nullptr);
auto value = ConfigurationManager::getConfigurationValue(up ? "maxuploadconnections" : "maxdownloadconnections", -1); auto value = ConfigurationManager::getConfigurationValue(up ? "maxuploadconnections" : "maxdownloadconnections", -1);
api->setMaxConnections(up ? 1 : 0, value, megaCmdListener.get()); if (value != -1)
megaCmdListener->wait();
if (megaCmdListener->getError()->getErrorCode() != MegaError::API_OK)
{ {
LOG_err << "Failed to change max " << (up ? "upload" : "download") << " connections: " api->setMaxConnections(up ? 1 : 0, value, megaCmdListener.get());
<< megaCmdListener->getError()->getErrorString(); megaCmdListener->wait();
if (megaCmdListener->getError()->getErrorCode() != MegaError::API_OK)
{
LOG_err << "Failed to change max " << (up ? "upload" : "download") << " connections: "
<< megaCmdListener->getError()->getErrorString();
}
} }
} }