Schedule delayed scan when being disconnected from an AP
authorSamuel Ortiz <sameo@linux.intel.com>
Wed, 22 Sep 2010 14:49:45 +0000 (16:49 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 22 Sep 2010 14:53:52 +0000 (16:53 +0200)
When being disconnected from an AP, a delayed scan is scheduled to make
sure the AP is still there. wpa_supplicant removes a BSS from its bss list
when it disappears from the scan results twice in a row.

Fixes BCM #6831

plugins/supplicant.c

index a81eb04..d0357f3 100644 (file)
@@ -2226,6 +2226,15 @@ static void scanning(struct supplicant_task *task, DBusMessage *msg)
                                scanning == TRUE ? "started" : "finished");
 }
 
+static gboolean delayed_scan(gpointer user_data)
+{
+       struct supplicant_task *task = user_data;
+
+       supplicant_scan(task->device);
+
+       return FALSE;
+}
+
 static void state_change(struct supplicant_task *task, DBusMessage *msg)
 {
        DBusError error;
@@ -2319,8 +2328,12 @@ static void state_change(struct supplicant_task *task, DBusMessage *msg)
                                task_connect(task);
                        } else
                                task->network = NULL;
-               } else
+               } else {
+                       if (task->state == WPA_DISCONNECTED)
+                               g_timeout_add_seconds(10, delayed_scan, task);
+
                        remove_network(task);
+               }
 
                break;