summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2016-10-07 14:57:26 -0500
committerThomas Haller <thaller@redhat.com>2016-10-08 10:23:22 +0200
commitb39869750cf5ed60da5b983cd8801520d29089db (patch)
treecdc9e159fddbf91236d5f58674dd8b7d9053641b
parent8b1d569e9194ee8c085a83aa630ceacb80576500 (diff)
downloadNetworkManager-b39869750cf5ed60da5b983cd8801520d29089db.tar.gz
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
-rw-r--r--src/devices/wifi/nm-device-wifi.c12
1 files 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: