NetworkManager r3572 - in trunk: . src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3572 - in trunk: . src
- Date: Thu, 17 Apr 2008 18:10:01 +0100 (BST)
Author: dcbw
Date: Thu Apr 17 18:09:59 2008
New Revision: 3572
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3572&view=rev
Log:
2008-04-17 Dan Williams <dcbw redhat com>
* src/nm-device-802-11-wireless.c
- (state_changed_cb): clear AP list when device transitions to
unavailable or unmanaged
- (nm_device_802_11_wireless_dispose): remove redundant set_current_ap()
since this is already done in device_cleanup()
- (supplicant_iface_scanned_ap_cb): don't leak new APs when the device
isn't available or managed
- (device_cleanup): use remove_all_aps()
- (remove_all_aps): consolidate code removing all APs
Modified:
trunk/ChangeLog
trunk/src/nm-device-802-11-wireless.c
Modified: trunk/src/nm-device-802-11-wireless.c
==============================================================================
--- trunk/src/nm-device-802-11-wireless.c (original)
+++ trunk/src/nm-device-802-11-wireless.c Thu Apr 17 18:09:59 2008
@@ -760,6 +760,23 @@
}
static void
+remove_all_aps (NMDevice80211Wireless *self)
+{
+ NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
+
+ /* Remove outdated APs */
+ while (g_slist_length (priv->ap_list)) {
+ NMAccessPoint *ap = NM_AP (priv->ap_list->data);
+
+ access_point_removed (self, ap);
+ priv->ap_list = g_slist_remove (priv->ap_list, ap);
+ g_object_unref (ap);
+ }
+ g_slist_free (priv->ap_list);
+ priv->ap_list = NULL;
+}
+
+static void
device_cleanup (NMDevice80211Wireless *self)
{
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
@@ -791,11 +808,8 @@
priv->supplicant.mgr = NULL;
}
- g_slist_foreach (self->priv->ap_list, (GFunc) g_object_unref, NULL);
- g_slist_free (self->priv->ap_list);
- self->priv->ap_list = NULL;
-
set_current_ap (self, NULL);
+ remove_all_aps (self);
}
static void
@@ -1819,16 +1833,22 @@
}
static void
-supplicant_iface_scanned_ap_cb (NMSupplicantInterface * iface,
+supplicant_iface_scanned_ap_cb (NMSupplicantInterface *iface,
GHashTable *properties,
- NMDevice80211Wireless * self)
+ NMDevice80211Wireless *self)
{
+ NMDeviceState state;
NMAccessPoint *ap;
g_return_if_fail (self != NULL);
g_return_if_fail (properties != NULL);
g_return_if_fail (iface != NULL);
+ /* Ignore new APs when unavailable or unamnaged */
+ state = nm_device_get_state (NM_DEVICE (self));
+ if (state <= NM_DEVICE_STATE_UNAVAILABLE)
+ return;
+
ap = nm_ap_new_from_properties (properties);
if (!ap)
return;
@@ -2983,8 +3003,6 @@
device_cleanup (self);
- set_current_ap (self, NULL);
-
if (priv->state_to_disconnected_id) {
g_source_remove (priv->state_to_disconnected_id);
priv->state_to_disconnected_id = 0;
@@ -3148,6 +3166,7 @@
{
NMDevice80211Wireless *self = NM_DEVICE_802_11_WIRELESS (device);
NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self);
+ gboolean clear_aps = FALSE;
/* Remove any previous delayed transition to disconnected */
if (priv->state_to_disconnected_id) {
@@ -3156,6 +3175,9 @@
}
switch (state) {
+ case NM_DEVICE_STATE_UNMANAGED:
+ clear_aps = TRUE;
+ break;
case NM_DEVICE_STATE_UNAVAILABLE:
/* If transitioning to UNAVAILBLE and the device is not rfkilled,
* transition to DISCONNECTED because the device is ready to use.
@@ -3164,6 +3186,7 @@
*/
if (priv->enabled)
priv->state_to_disconnected_id = g_idle_add (unavailable_to_disconnected, self);
+ clear_aps = TRUE;
break;
case NM_DEVICE_STATE_ACTIVATED:
activation_success_handler (device);
@@ -3177,6 +3200,9 @@
default:
break;
}
+
+ if (clear_aps)
+ remove_all_aps (self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]