Added exitdelay in licensing system
This commit is contained in:
parent
bf382cbea0
commit
c5e961fd8d
3 changed files with 11 additions and 0 deletions
|
@ -429,6 +429,12 @@ int main_loop(int argc, char ** argv){
|
|||
//give everything some time to print messages
|
||||
Util::wait(100);
|
||||
std::cout << "Killed all processes, wrote config to disk. Exiting." << std::endl;
|
||||
if (Controller::exitDelay){
|
||||
std::cout << "Delaying shutdown by " << Controller::exitDelay << " seconds, on license server request..." << std::endl;
|
||||
while (Controller::exitDelay--){
|
||||
Util::wait(1000);
|
||||
}
|
||||
}
|
||||
if (Controller::restarting){
|
||||
return 42;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
namespace Controller{
|
||||
|
||||
uint64_t exitDelay = 0;
|
||||
static JSON::Value currentLicense;
|
||||
static uint64_t lastCheck = 0;
|
||||
|
||||
|
@ -67,6 +68,9 @@ namespace Controller{
|
|||
INFO_MSG("Checking license time");
|
||||
if(!isLicensed()){
|
||||
FAIL_MSG("Not licensed, shutting down");
|
||||
if (currentLicense.isMember("delay") && currentLicense["delay"].asInt()){
|
||||
exitDelay = currentLicense["delay"].asInt();
|
||||
}
|
||||
kill(getpid(), SIGINT);
|
||||
conf.is_active = false;
|
||||
return false;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <mist/json.h>
|
||||
|
||||
namespace Controller{
|
||||
extern uint64_t exitDelay;
|
||||
|
||||
const JSON::Value & getLicense();
|
||||
void initLicense();
|
||||
|
|
Loading…
Add table
Reference in a new issue