Adding support for disabling autoupdating.

This commit is contained in:
stephb9959
2021-10-07 23:07:27 -07:00
parent 855b1b8eec
commit 96a8b8cc45
3 changed files with 11 additions and 5 deletions

2
build
View File

@@ -1 +1 @@
63
65

View File

@@ -48,6 +48,7 @@ s3.key = *******************************************
s3.retry = 60
s3.bucket.uri = ucentral-ap-firmware.s3.amazonaws.com
autoupdater.enabled = true
#############################
# Generic information for all micro services

View File

@@ -15,18 +15,23 @@ namespace OpenWifi {
int AutoUpdater::Start() {
Running_ = true;
AutoUpdaterFrequency_ = Daemon()->ConfigGetInt("autoupdater.frequency",600);
AutoUpdaterEnabled_ = Daemon()->ConfigGetBool("autoupdater.enabled", true);
Thr_.start(*this);
AutoUpdaterEnabled_ = Daemon()->ConfigGetBool("autoupdater.enabled", false);
if(AutoUpdaterEnabled_)
Thr_.start(*this);
return 0;
}
void AutoUpdater::Stop() {
Running_ = false;
Thr_.wakeUp();
Thr_.join();
if(AutoUpdaterEnabled_) {
Thr_.wakeUp();
Thr_.join();
}
}
void AutoUpdater::ToBeUpgraded(std::string serialNumber, std::string DeviceType) {
if(!AutoUpdaterEnabled_)
return;
std::lock_guard G(Mutex_);
Queue_.emplace_back(std::make_pair(std::move(serialNumber),std::move(DeviceType)));
}