diff options
Diffstat (limited to 'wsd/COOLWSD.cpp')
-rw-r--r-- | wsd/COOLWSD.cpp | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp index 6bb7d70991..6fc103562a 100644 --- a/wsd/COOLWSD.cpp +++ b/wsd/COOLWSD.cpp @@ -400,8 +400,10 @@ void COOLWSD::writeTraceEventRecording(const std::string &recording) void COOLWSD::checkSessionLimitsAndWarnClients() { -#if !ENABLE_SUPPORT_KEY #if !MOBILEAPP + if (config::isSupportKeyEnabled()) + return; + ssize_t docBrokerCount = DocBrokers.size() - ConvertToBroker::getInstanceCount(); if (COOLWSD::MaxDocuments < 10000 && (docBrokerCount > static_cast<ssize_t>(COOLWSD::MaxDocuments) || COOLWSD::NumConnections >= COOLWSD::MaxConnections)) @@ -419,7 +421,6 @@ void COOLWSD::checkSessionLimitsAndWarnClients() } } #endif -#endif } void COOLWSD::checkDiskSpaceAndWarnClients(const bool cacheLastCheck) @@ -2688,44 +2689,45 @@ void COOLWSD::innerInitialize(Application& self) setenv("LOK_HELP_URL", "", 1); #endif -#if ENABLE_SUPPORT_KEY - const std::string supportKeyString = getConfigValue<std::string>(conf, "support_key", ""); - - if (supportKeyString.empty()) - { - LOG_WRN("Support key not set, please use 'coolconfig set-support-key'."); - std::cerr << "Support key not set, please use 'coolconfig set-support-key'." << std::endl; - COOLWSD::OverrideWatermark = "Unsupported, the support key is missing."; - } - else + if (config::isSupportKeyEnabled()) { - SupportKey key(supportKeyString); + const std::string supportKeyString = getConfigValue<std::string>(conf, "support_key", ""); - if (!key.verify()) + if (supportKeyString.empty()) { - LOG_WRN("Invalid support key, please use 'coolconfig set-support-key'."); - std::cerr << "Invalid support key, please use 'coolconfig set-support-key'." << std::endl; - COOLWSD::OverrideWatermark = "Unsupported, the support key is invalid."; + LOG_WRN("Support key not set, please use 'coolconfig set-support-key'."); + std::cerr << "Support key not set, please use 'coolconfig set-support-key'." << std::endl; + COOLWSD::OverrideWatermark = "Unsupported, the support key is missing."; } else { - int validDays = key.validDaysRemaining(); - if (validDays <= 0) + SupportKey key(supportKeyString); + + if (!key.verify()) { - LOG_WRN("Your support key has expired, please ask for a new one, and use 'coolconfig set-support-key'."); - std::cerr << "Your support key has expired, please ask for a new one, and use 'coolconfig set-support-key'." << std::endl; - COOLWSD::OverrideWatermark = "Unsupported, the support key has expired."; + LOG_WRN("Invalid support key, please use 'coolconfig set-support-key'."); + std::cerr << "Invalid support key, please use 'coolconfig set-support-key'." << std::endl; + COOLWSD::OverrideWatermark = "Unsupported, the support key is invalid."; } else { - LOG_INF("Your support key is valid for " << validDays << " days"); - COOLWSD::MaxConnections = 1000; - COOLWSD::MaxDocuments = 200; - COOLWSD::OverrideWatermark.clear(); + int validDays = key.validDaysRemaining(); + if (validDays <= 0) + { + LOG_WRN("Your support key has expired, please ask for a new one, and use 'coolconfig set-support-key'."); + std::cerr << "Your support key has expired, please ask for a new one, and use 'coolconfig set-support-key'." << std::endl; + COOLWSD::OverrideWatermark = "Unsupported, the support key has expired."; + } + else + { + LOG_INF("Your support key is valid for " << validDays << " days"); + COOLWSD::MaxConnections = 1000; + COOLWSD::MaxDocuments = 200; + COOLWSD::OverrideWatermark.clear(); + } } } } -#endif if (COOLWSD::MaxConnections < 3) { |