+ } else {
+ if (data->scan_interval == data->short_interval) {
+ data->short_scan_count++;
+ /*
+ * Spend at most the duration of a long scan interval
+ * scanning at the short scan interval. After that,
+ * revert to the long scan interval.
+ */
+ if (data->short_scan_count > data->max_short_scans) {
+ data->scan_interval = data->long_interval;
+ wpa_printf(MSG_DEBUG, "bgscan simple: Backing "
+ "off to long scan interval");
+ }
+ } else if (data->short_scan_count > 0) {
+ /*
+ * If we lasted a long scan interval without any
+ * CQM triggers, decrease the short-scan count,
+ * which allows 1 more short-scan interval to
+ * occur in the future when CQM triggers.
+ */
+ data->short_scan_count--;
+ }
+ os_get_reltime(&data->last_bgscan);
+ }