diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2015-04-02 16:27:02 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-04-02 17:48:31 +0200 |
commit | 4903c127e15922bce64121e17c69ec44c28b6784 (patch) | |
tree | c600498a096353b5a8d459c7167fbef669b56dee /src/devices/wifi | |
parent | c9910b35bdd2bd8e4222e129628049ab553246af (diff) |
wifi: clear WPAS_REMOVED_TAG when scanning Wi-Fi AP
(cherry picked from commit 47c505523c72b6454dec4681c0edda535c3a2e91)
(cherry picked from commit 1282b468bd88cb587b42203e18b18f818ef1fb74)
https://bugzilla.gnome.org/show_bug.cgi?id=733105
Diffstat (limited to 'src/devices/wifi')
-rw-r--r-- | src/devices/wifi/nm-device-wifi.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 9633175f48..6b72007232 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -1622,6 +1622,8 @@ supplicant_iface_scan_done_cb (NMSupplicantInterface *iface, * */ +#define WPAS_REMOVED_TAG "supplicant-removed" + static void try_fill_ssid_for_hidden_ap (NMAccessPoint *ap) { @@ -1729,6 +1731,7 @@ merge_scanned_ap (NMDeviceWifi *self, * fake, since it clearly exists somewhere. */ nm_ap_set_fake (found_ap, FALSE); + g_object_set_data (G_OBJECT (found_ap), WPAS_REMOVED_TAG, NULL); } else { /* New entry in the list */ _LOGD (LOGD_WIFI_SCAN, "adding new AP '%s' %s (%p)", @@ -1742,8 +1745,6 @@ merge_scanned_ap (NMDeviceWifi *self, } } -#define WPAS_REMOVED_TAG "supplicant-removed" - static gboolean cull_scan_list (NMDeviceWifi *self) { @@ -1898,9 +1899,23 @@ supplicant_iface_bss_removed_cb (NMSupplicantInterface *iface, g_return_if_fail (object_path != NULL); ap = get_ap_by_supplicant_path (self, object_path); - if (ap) + if (ap) { + gint32 now = nm_utils_get_monotonic_timestamp_s (); + gint32 last_seen = nm_ap_get_last_seen (ap); + + /* We don't know when the supplicant last saw the AP's beacons, + * it could be two minutes or it could be 2 seconds. Because the + * supplicant doesn't send property change notifications if the + * AP's other properties don't change, our last-seen time may be + * much older the supplicant's, and the AP would be immediately + * removed from the list on the next cleanup. So update the + * last-seen time to ensure the AP sticks around for at least + * one more periodic scan. + */ + nm_ap_set_last_seen (ap, MAX (last_seen, now - SCAN_INTERVAL_MAX)); g_object_set_data (G_OBJECT (ap), WPAS_REMOVED_TAG, GUINT_TO_POINTER (TRUE)); } +} static void remove_supplicant_timeouts (NMDeviceWifi *self) |