From b39869750cf5ed60da5b983cd8801520d29089db Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Fri, 7 Oct 2016 14:57:26 -0500 Subject: wifi: clean up clearing a pending scan All callers of request_wireless_scan() cleared the periodic scan source immediately before calling the function, so just move that into request_wireless_scan(). The only one that doesn't clear it is request_wireless_scan_periodic() but that sets the source id to 0 already, so the clear has no effect. https://mail.gnome.org/archives/networkmanager-list/2016-October/msg00012.html --- src/devices/wifi/nm-device-wifi.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 17c966bd7c..477af4aa23 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -538,10 +538,8 @@ deactivate (NMDevice *device) } /* Ensure we trigger a scan after deactivating a Hotspot */ - if (old_mode == NM_802_11_MODE_AP) { - nm_clear_g_source (&priv->pending_scan_id); + if (old_mode == NM_802_11_MODE_AP) request_wireless_scan (self, NULL); - } } static void @@ -1139,7 +1137,6 @@ request_scan_cb (NMDevice *device, priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - nm_clear_g_source (&priv->pending_scan_id); request_wireless_scan (self, new_scan_options); g_dbus_method_invocation_return_value (context, NULL); } @@ -1381,6 +1378,8 @@ request_wireless_scan (NMDeviceWifi *self, GVariant *scan_options) gboolean backoff = FALSE; GPtrArray *ssids = NULL; + nm_clear_g_source (&priv->pending_scan_id); + if (priv->requested_scan) { /* There's already a scan in progress */ return; @@ -1435,7 +1434,6 @@ request_wireless_scan (NMDeviceWifi *self, GVariant *scan_options) } else _LOGD (LOGD_WIFI_SCAN, "scan requested but not allowed at this time"); - priv->pending_scan_id = 0; schedule_scan (self, backoff); } @@ -1447,7 +1445,7 @@ request_wireless_scan_periodic (gpointer user_data) priv->pending_scan_id = 0; request_wireless_scan (self, NULL); - return FALSE; + return G_SOURCE_REMOVE; } /* @@ -2046,7 +2044,6 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, break; case NM_SUPPLICANT_INTERFACE_STATE_INACTIVE: _requested_scan_set (self, FALSE); - nm_clear_g_source (&priv->pending_scan_id); request_wireless_scan (self, NULL); break; default: @@ -2927,7 +2924,6 @@ device_state_changed (NMDevice *device, case NM_DEVICE_STATE_DISCONNECTED: /* Kick off a scan to get latest results */ priv->scan_interval = SCAN_INTERVAL_MIN; - nm_clear_g_source (&priv->pending_scan_id); request_wireless_scan (self, NULL); break; default: -- cgit v1.2.1