Fixed server not starting after license expires
This commit is contained in:
parent
dbca214ef2
commit
92bb168b4e
@ -188,7 +188,7 @@ bool LicenseServer::handleServerValidation(shared_ptr<ConnectedClient> &client,
|
|||||||
logMessage(LOG_GENERAL, "[CLIENT][{}] Remote license has been deleted! Shutting down server!", client->address());
|
logMessage(LOG_GENERAL, "[CLIENT][{}] Remote license has been deleted! Shutting down server!", client->address());
|
||||||
} else {
|
} else {
|
||||||
fill_info(response.mutable_license_info(), info, remote_license->data.licenceKey);
|
fill_info(response.mutable_license_info(), info, remote_license->data.licenceKey);
|
||||||
auto is_invalid = !info->isValid();
|
auto is_invalid = !info->isNotExpired();
|
||||||
if(is_invalid) {
|
if(is_invalid) {
|
||||||
response.set_invalid_reason("license is invalid");
|
response.set_invalid_reason("license is invalid");
|
||||||
response.set_valid(false);
|
response.set_valid(false);
|
||||||
|
@ -348,7 +348,7 @@ namespace license {
|
|||||||
bool deleted{false};
|
bool deleted{false};
|
||||||
uint32_t upgrade_id{0};
|
uint32_t upgrade_id{0};
|
||||||
|
|
||||||
inline bool isValid() { return (end.time_since_epoch().count() == 0 || std::chrono::system_clock::now() < this->end); }
|
inline bool isNotExpired() { return (end.time_since_epoch().count() == 0 || std::chrono::system_clock::now() < this->end); }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::shared_ptr<License> readLocalLicence(const std::string &, std::string &);
|
extern std::shared_ptr<License> readLocalLicence(const std::string &, std::string &);
|
||||||
|
@ -482,7 +482,6 @@ vector<string> config::parseConfig(const std::string& path) {
|
|||||||
goto license_parsing;
|
goto license_parsing;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(!config::license->isValid()) {
|
if(!config::license->isValid()) {
|
||||||
if(config::license->data.type == license::LicenseType::INVALID) {
|
if(config::license->data.type == license::LicenseType::INVALID) {
|
||||||
errors.emplace_back(strobf("Give license isn't valid!").string());
|
errors.emplace_back(strobf("Give license isn't valid!").string());
|
||||||
@ -492,9 +491,9 @@ vector<string> config::parseConfig(const std::string& path) {
|
|||||||
logErrorFmt(true, LOG_GENERAL, strobf("The given license isn't valid!").string());
|
logErrorFmt(true, LOG_GENERAL, strobf("The given license isn't valid!").string());
|
||||||
logErrorFmt(true, LOG_GENERAL, strobf("Falling back to the default license.").string());
|
logErrorFmt(true, LOG_GENERAL, strobf("Falling back to the default license.").string());
|
||||||
teaspeak_license = "none";
|
teaspeak_license = "none";
|
||||||
|
|
||||||
goto license_parsing;
|
goto license_parsing;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -320,7 +320,7 @@ void LicenseService::send_license_validate_request() {
|
|||||||
void LicenseService::handle_message_license_info(const void *buffer, size_t buffer_length) {
|
void LicenseService::handle_message_license_info(const void *buffer, size_t buffer_length) {
|
||||||
std::lock_guard rlock{this->request_lock};
|
std::lock_guard rlock{this->request_lock};
|
||||||
if(this->request_state_ != request_state::license_validate) {
|
if(this->request_state_ != request_state::license_validate) {
|
||||||
this->handle_check_fail(strobf("finvalid request state for license response packet").string());
|
this->handle_check_fail(strobf("invalid request state for license response packet").string());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ namespace google::protobuf {
|
|||||||
|
|
||||||
namespace ts::server::license {
|
namespace ts::server::license {
|
||||||
struct InstanceLicenseInfo {
|
struct InstanceLicenseInfo {
|
||||||
|
bool is_old_license{false};
|
||||||
std::shared_ptr<::license::License> license{nullptr};
|
std::shared_ptr<::license::License> license{nullptr};
|
||||||
std::string web_certificate_revision{};
|
std::string web_certificate_revision{};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user