mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-02 03:17:48 +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,
|
'offline': 4 * 60 * 60,
|
||||||
'validate': 120,
|
'validate': 120,
|
||||||
'orphan': 2 * 60 * 60,
|
'orphan': 2 * 60 * 60,
|
||||||
|
interval: 10000,
|
||||||
};
|
};
|
||||||
|
|
||||||
ulog_open(ULOG_SYSLOG | ULOG_STDIO, LOG_DAEMON, "cloud_discover");
|
ulog_open(ULOG_SYSLOG | ULOG_STDIO, LOG_DAEMON, "cloud_discover");
|
||||||
@@ -196,6 +197,19 @@ function time_is_valid() {
|
|||||||
|
|
||||||
function interval_handler() {
|
function interval_handler() {
|
||||||
printf(`State ${state}\n`);
|
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) {
|
switch(state) {
|
||||||
case ORPHAN:
|
case ORPHAN:
|
||||||
if (time() - orphan_time <= timeouts.orphan_skew)
|
if (time() - orphan_time <= timeouts.orphan_skew)
|
||||||
@@ -329,7 +343,7 @@ if (gateway_available()) {
|
|||||||
|
|
||||||
timeouts_load();
|
timeouts_load();
|
||||||
|
|
||||||
interval = uloop.interval(10000, interval_handler);
|
interval = uloop.interval(timeouts.interval, interval_handler);
|
||||||
|
|
||||||
ubus.publish('cloud', ubus_methods);
|
ubus.publish('cloud', ubus_methods);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user