[PATCH] wpa_supplicant: Honor initial bgscan timer

Paul Stewart pstew
Thu Aug 19 08:46:34 PDT 2010


    Honor the interval setup in bgscan_simple_init even if we
    get notified of a signal change.  This prevents the system
    from doing a bgscan too early after connecting to a network
    (for example, during DHCP)

    BUG=chromium-os:5458

    Review URL: http://codereview.chromium.org/3020075

Signed-off-by: Paul Stewart <pstew at google.com>

diff --git a/wpa_supplicant/bgscan_simple.c b/wpa_supplicant/bgscan_simple.c
index a932553..aeef7e8 100644
--- a/wpa_supplicant/bgscan_simple.c
+++ b/wpa_supplicant/bgscan_simple.c
@@ -31,6 +31,7 @@ struct bgscan_simple_data {
        int short_interval; /* use if signal < threshold */
        int long_interval; /* use if signal > threshold */
        struct os_time last_bgscan;
+       int init_scan;
 };


@@ -57,8 +58,10 @@ static void bgscan_simple_timeout(void *eloop_ctx,
void *timeout_ctx)
                wpa_printf(MSG_DEBUG, "bgscan simple: Failed to trigger scan");
                eloop_register_timeout(data->scan_interval, 0,
                                       bgscan_simple_timeout, data, NULL);
-       } else
+       } else {
                os_get_time(&data->last_bgscan);
+               data->init_scan = 0;
+       }
 }


@@ -122,6 +125,7 @@ static void * bgscan_simple_init(struct
wpa_supplicant *wpa_s,
        }

        data->scan_interval = data->short_interval;
+       data->init_scan = 1;
        eloop_register_timeout(data->scan_interval, 0, bgscan_simple_timeout,
                               data, NULL);
        return data;
@@ -171,7 +175,8 @@ static void
bgscan_simple_notify_signal_change(void *priv, int above)
        struct bgscan_simple_data *data = priv;

        if (data->short_interval == data->long_interval ||
-           data->signal_threshold == 0)
+           data->signal_threshold == 0 ||
+           data->init_scan != 0)
                return;

        wpa_printf(MSG_DEBUG, "bgscan simple: signal level changed "



More information about the Hostap mailing list