summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-06-28 15:45:46 -0500
committerDan Williams <dcbw@redhat.com>2012-06-28 16:34:08 -0500
commit582cb7d2712d6fa5925940b354a88d712da7fedb (patch)
treeea0b45107bde80d13a971c4eea0b4f20a6ce43b5 /src
parent85270617eb91f4d7ce12237deac9f2dd25dc3eb6 (diff)
downloadNetworkManager-582cb7d2712d6fa5925940b354a88d712da7fedb.tar.gz
wifi: merge two functions
No point in having them separate.
Diffstat (limited to 'src')
-rw-r--r--src/nm-device-wifi.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index 5fbbac7aa2..e8d0037265 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -696,12 +696,25 @@ set_current_ap (NMDeviceWifi *self, NMAccessPoint *new_ap)
g_free (old_path);
}
-static void
-periodic_update (NMDeviceWifi *self)
+/* Called both as a GSourceFunc and standalone */
+static gboolean
+periodic_update (gpointer user_data)
{
+ NMDeviceWifi *self = NM_DEVICE_WIFI (user_data);
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
NMAccessPoint *new_ap;
guint32 new_rate, percent;
+ NMDeviceState state;
+
+ /* BSSID and signal strength have meaningful values only if the device
+ * is activated and not scanning.
+ */
+ state = nm_device_get_state (NM_DEVICE (self));
+ if (state != NM_DEVICE_STATE_ACTIVATED)
+ return TRUE;
+
+ if (nm_supplicant_interface_get_scanning (priv->supplicant.iface))
+ return TRUE;
/* In IBSS mode, most newer firmware/drivers do "BSS coalescing" where
* multiple IBSS stations using the same SSID will eventually switch to
@@ -771,33 +784,7 @@ periodic_update (NMDeviceWifi *self)
priv->rate = new_rate;
g_object_notify (G_OBJECT (self), NM_DEVICE_WIFI_BITRATE);
}
-}
-
-/*
- * nm_device_wifi_periodic_update
- *
- * Periodically update device statistics.
- *
- */
-static gboolean
-nm_device_wifi_periodic_update (gpointer data)
-{
- NMDeviceWifi *self = NM_DEVICE_WIFI (data);
- NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
- NMDeviceState state;
- /* BSSID and signal strength have meaningful values only if the device
- is activated and not scanning */
- state = nm_device_get_state (NM_DEVICE (self));
- if (state != NM_DEVICE_STATE_ACTIVATED)
- goto out;
-
- if (nm_supplicant_interface_get_scanning (priv->supplicant.iface))
- goto out;
-
- periodic_update (self);
-
-out:
return TRUE;
}
@@ -837,7 +824,7 @@ real_bring_up (NMDevice *dev)
NMDeviceWifi *self = NM_DEVICE_WIFI (dev);
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
- priv->periodic_source_id = g_timeout_add_seconds (6, nm_device_wifi_periodic_update, self);
+ priv->periodic_source_id = g_timeout_add_seconds (6, periodic_update, self);
return TRUE;
}