diff options
author | Thomas Haller <thaller@redhat.com> | 2016-01-19 14:17:24 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-03-02 16:43:54 +0100 |
commit | 9345900f281024629781ad785db16d081fcebacf (patch) | |
tree | 5cc558f8b28d65c235625ef299ebe911175cc350 | |
parent | 2c007671c900d78d44a052870c9d2bc1031622b4 (diff) |
device/wifi: replace cancel_pending_scan() with nm_clear_g_source()
(cherry picked from commit 84828960ff4eb924e63b4aa60fdfdd376055c7d4)
-rw-r--r-- | src/devices/wifi/nm-device-wifi.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 4198a8a32e..bb0c4512bb 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -146,8 +146,6 @@ static gboolean check_scanning_allowed (NMDeviceWifi *self); static void schedule_scan (NMDeviceWifi *self, gboolean backoff); -static void cancel_pending_scan (NMDeviceWifi *self); - static void cleanup_association_attempt (NMDeviceWifi * self, gboolean disconnect); @@ -261,7 +259,7 @@ supplicant_interface_release (NMDeviceWifi *self) priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - cancel_pending_scan (self); + nm_clear_g_source (&priv->pending_scan_id); /* Reset the scan interval to be pretty frequent when disconnected */ priv->scan_interval = SCAN_INTERVAL_MIN + SCAN_INTERVAL_STEP; @@ -734,7 +732,7 @@ deactivate (NMDevice *device) /* Ensure we trigger a scan after deactivating a Hotspot */ if (old_mode == NM_802_11_MODE_AP) { - cancel_pending_scan (self); + nm_clear_g_source (&priv->pending_scan_id); request_wireless_scan (self, NULL); } } @@ -1237,6 +1235,7 @@ request_scan_cb (NMDevice *device, gpointer user_data) { NMDeviceWifi *self = NM_DEVICE_WIFI (device); + NMDeviceWifiPrivate *priv; GError *local = NULL; gs_unref_hashtable GHashTable *new_scan_options = user_data; @@ -1254,7 +1253,9 @@ request_scan_cb (NMDevice *device, return; } - cancel_pending_scan (self); + priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + + nm_clear_g_source (&priv->pending_scan_id); request_wireless_scan (self, new_scan_options); dbus_g_method_return (context); } @@ -1554,7 +1555,7 @@ schedule_scan (NMDeviceWifi *self, gboolean backoff) /* Cancel the pending scan if it would happen later than (now + the scan_interval) */ if (priv->pending_scan_id) { if (now + priv->scan_interval < priv->scheduled_scan_time) - cancel_pending_scan (self); + nm_clear_g_source (&priv->pending_scan_id); } if (!priv->pending_scan_id) { @@ -1587,18 +1588,6 @@ schedule_scan (NMDeviceWifi *self, gboolean backoff) } } - -static void -cancel_pending_scan (NMDeviceWifi *self) -{ - NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - - if (priv->pending_scan_id) { - g_source_remove (priv->pending_scan_id); - priv->pending_scan_id = 0; - } -} - static void supplicant_iface_scan_done_cb (NMSupplicantInterface *iface, gboolean success, @@ -3115,7 +3104,7 @@ device_state_changed (NMDevice *device, case NM_DEVICE_STATE_DISCONNECTED: /* Kick off a scan to get latest results */ priv->scan_interval = SCAN_INTERVAL_MIN; - cancel_pending_scan (self); + nm_clear_g_source (&priv->pending_scan_id); request_wireless_scan (self, NULL); break; default: |