connman_bool_t disconnected;
connman_bool_t reconnect;
connman_uint16_t scan_interval;
+ connman_uint16_t backoff_interval;
char *name;
char *node;
char *address;
GHashTable *networks;
};
+#define SCAN_INITIAL_DELAY 10
+
static gboolean device_scan_trigger(gpointer user_data)
{
struct connman_device *device = user_data;
clear_scan_trigger(device);
if (device->scan_interval > 0) {
- guint interval = device->scan_interval;
+ guint interval;
+
+ if (g_hash_table_size(device->networks) == 0) {
+ if (device->backoff_interval >= device->scan_interval)
+ device->backoff_interval = SCAN_INITIAL_DELAY;
+ interval = device->backoff_interval;
+ } else
+ interval = device->scan_interval;
+
+ DBG("interval %d", interval);
+
device->scan_timeout = g_timeout_add_seconds(interval,
device_scan_trigger, device);
+
+ device->backoff_interval *= 2;
+ if (device->backoff_interval > device->scan_interval)
+ device->backoff_interval = device->scan_interval;
}
}
service_type = __connman_device_get_service_type(device);
device->blocked = __connman_technology_get_blocked(service_type);
+ device->backoff_interval = SCAN_INITIAL_DELAY;
switch (type) {
case CONNMAN_DEVICE_TYPE_UNKNOWN:
return;
device->connections--;
+
+ if (device->connections == 0)
+ device->backoff_interval = SCAN_INITIAL_DELAY;
}
/**