@@ -814,7 +814,10 @@ static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s,
wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
return;
}
- wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec);
+ if (wpa_s->scan_reschedule)
+ (wpa_s->scan_reschedule)(wpa_s, timeout_sec, timeout_usec);
+ else
+ wpa_supplicant_req_scan(wpa_s, timeout_sec, timeout_usec);
}
@@ -2633,6 +2633,15 @@ start:
wpas_p2p_join_start(wpa_s);
}
+static void wpas_p2p_join_scan_reschedule(struct wpa_supplicant *wpa_s,
+ int sec, int usec)
+{
+ wpa_dbg(wpa_s, MSG_DEBUG, "Setting P2P scan request: %d sec %d usec",
+ sec, usec);
+ eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL);
+ eloop_register_timeout(sec, usec, wpas_p2p_join_scan, wpa_s, NULL);
+}
+
static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx)
{
@@ -2678,6 +2687,7 @@ static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx)
* the new scan results become available.
*/
wpa_s->scan_res_handler = wpas_p2p_scan_res_join;
+ wpa_s->scan_reschedule = wpas_p2p_join_scan_reschedule;
ret = wpa_drv_scan(wpa_s,¶ms);
wpabuf_free(ies);
@@ -301,6 +301,8 @@ struct wpa_supplicant {
void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
struct wpa_scan_results *scan_res);
+ void (*scan_reschedule)(struct wpa_supplicant *wpa_s,
+ int sec, int usec);
struct dl_list bss; /* struct wpa_bss::list */
struct dl_list bss_id; /* struct wpa_bss::list_id */
size_t num_bss;