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());
|
||||
} else {
|
||||
fill_info(response.mutable_license_info(), info, remote_license->data.licenceKey);
|
||||
auto is_invalid = !info->isValid();
|
||||
auto is_invalid = !info->isNotExpired();
|
||||
if(is_invalid) {
|
||||
response.set_invalid_reason("license is invalid");
|
||||
response.set_valid(false);
|
||||
|
@ -348,7 +348,7 @@ namespace license {
|
||||
bool deleted{false};
|
||||
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 &);
|
||||
|
@ -482,7 +482,6 @@ vector<string> config::parseConfig(const std::string& path) {
|
||||
goto license_parsing;
|
||||
}
|
||||
|
||||
/*
|
||||
if(!config::license->isValid()) {
|
||||
if(config::license->data.type == license::LicenseType::INVALID) {
|
||||
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("Falling back to the default license.").string());
|
||||
teaspeak_license = "none";
|
||||
|
||||
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) {
|
||||
std::lock_guard rlock{this->request_lock};
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ namespace google::protobuf {
|
||||
|
||||
namespace ts::server::license {
|
||||
struct InstanceLicenseInfo {
|
||||
bool is_old_license{false};
|
||||
std::shared_ptr<::license::License> license{nullptr};
|
||||
std::string web_certificate_revision{};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user