mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 17:42:41 +00:00
add incremental interval backoff
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -26,6 +26,7 @@ let timeouts = {
|
||||
'offline': 4 * 60 * 60,
|
||||
'validate': 120,
|
||||
'orphan': 2 * 60 * 60,
|
||||
interval: 10000,
|
||||
};
|
||||
|
||||
ulog_open(ULOG_SYSLOG | ULOG_STDIO, LOG_DAEMON, "cloud_discover");
|
||||
@@ -196,6 +197,19 @@ function time_is_valid() {
|
||||
|
||||
function interval_handler() {
|
||||
printf(`State ${state}\n`);
|
||||
switch(state) {
|
||||
case DISCOVER:
|
||||
if (timeouts.interval < 60000)
|
||||
timeouts.interval += 10000;
|
||||
break;
|
||||
default:
|
||||
timeouts.interval = 10000;
|
||||
break;
|
||||
}
|
||||
|
||||
printf('setting interval to %d\n', timeouts.interval);
|
||||
interval.set(timeouts.interval);
|
||||
|
||||
switch(state) {
|
||||
case ORPHAN:
|
||||
if (time() - orphan_time <= timeouts.orphan_skew)
|
||||
@@ -329,7 +343,7 @@ if (gateway_available()) {
|
||||
|
||||
timeouts_load();
|
||||
|
||||
interval = uloop.interval(10000, interval_handler);
|
||||
interval = uloop.interval(timeouts.interval, interval_handler);
|
||||
|
||||
ubus.publish('cloud', ubus_methods);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user