From 76f418666b1d3f5417c0709fb0a75dc77d4e641f Mon Sep 17 00:00:00 2001 From: Tambet Ingo Date: Mon, 17 Mar 2008 20:59:54 +0000 Subject: [PATCH] Author: Tambet Ingo Date: Mon Mar 17 12:27:01 2008 -0600 2008-03-17 Tambet Ingo Clean up activating device deactivation. * src/nm-device.c (real_activation_cancel_handler): Remove. The same thing should be done whether the device activation gets cancelled or the device is just getting deactivated. (nm_device_activation_cancel): Remove. (nm_device_deactivate_quickly): Handle the case where device is activating. * src/nm-device-802-11-wireless.c (real_activation_cancel_handler): Remove. It does the exact same thing as real_deactivate_quickly(). git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3471 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 13 +++++++ src/nm-device-802-11-wireless.c | 22 ----------- src/nm-device.c | 68 +++++++-------------------------- src/nm-device.h | 4 -- 4 files changed, 26 insertions(+), 81 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16b15ad84d..03b0b64324 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-03-17 Tambet Ingo + + Clean up activating device deactivation. + + * src/nm-device.c (real_activation_cancel_handler): Remove. The same thing + should be done whether the device activation gets cancelled or the device + is just getting deactivated. + (nm_device_activation_cancel): Remove. + (nm_device_deactivate_quickly): Handle the case where device is activating. + + * src/nm-device-802-11-wireless.c (real_activation_cancel_handler): Remove. + It does the exact same thing as real_deactivate_quickly(). + 2008-03-17 Dan Williams Split the 802.1x bits out of the wireless-security setting so they are diff --git a/src/nm-device-802-11-wireless.c b/src/nm-device-802-11-wireless.c index 6fa8c18046..22362d33cb 100644 --- a/src/nm-device-802-11-wireless.c +++ b/src/nm-device-802-11-wireless.c @@ -2902,26 +2902,6 @@ activation_failure_handler (NMDevice *dev) ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)"); } -static void -real_activation_cancel_handler (NMDevice *dev) -{ - NMDevice80211Wireless *self = NM_DEVICE_802_11_WIRELESS (dev); - NMDevice80211WirelessPrivate *priv = NM_DEVICE_802_11_WIRELESS_GET_PRIVATE (self); - NMDevice80211WirelessClass *klass; - NMDeviceClass *parent_class; - - /* Chain up to parent first */ - klass = NM_DEVICE_802_11_WIRELESS_GET_CLASS (self); - parent_class = NM_DEVICE_CLASS (g_type_class_peek_parent (klass)); - parent_class->activation_cancel_handler (dev); - - cleanup_association_attempt (self, TRUE); - - set_current_ap (self, NULL); - priv->rate = 0; -} - - static gboolean real_can_interrupt_activation (NMDevice *dev) { @@ -3026,8 +3006,6 @@ nm_device_802_11_wireless_class_init (NMDevice80211WirelessClass *klass) parent_class->deactivate_quickly = real_deactivate_quickly; parent_class->can_interrupt_activation = real_can_interrupt_activation; - parent_class->activation_cancel_handler = real_activation_cancel_handler; - /* Properties */ g_object_class_install_property (object_class, PROP_HW_ADDRESS, diff --git a/src/nm-device.c b/src/nm-device.c index 2ff3301315..d43dc2f15a 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -989,52 +989,6 @@ clear_act_request (NMDevice *self) priv->act_request = NULL; } -static void -real_activation_cancel_handler (NMDevice *self) -{ - if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG && - nm_device_get_use_dhcp (self)) { - - nm_dhcp_manager_cancel_transaction (NM_DEVICE_GET_PRIVATE (self)->dhcp_manager, - nm_device_get_iface (self)); - } -} - - -/* - * nm_device_activation_cancel - * - * Signal activation worker that it should stop and die. - * - */ -void -nm_device_activation_cancel (NMDevice *self) -{ - NMDeviceClass *klass; - - g_return_if_fail (self != NULL); - - if (!nm_device_is_activating (self)) - return; - - nm_info ("Activation (%s): cancelling...", nm_device_get_iface (self)); - - /* Break the activation chain */ - if (self->priv->act_source_id) { - g_source_remove (self->priv->act_source_id); - self->priv->act_source_id = 0; - } - - klass = NM_DEVICE_CLASS (g_type_class_peek (NM_TYPE_DEVICE)); - if (klass->activation_cancel_handler) - klass->activation_cancel_handler (self); - - clear_act_request (self); - - nm_info ("Activation (%s): cancelled.", nm_device_get_iface (self)); -} - - /* * nm_device_deactivate_quickly * @@ -1046,22 +1000,27 @@ nm_device_activation_cancel (NMDevice *self) gboolean nm_device_deactivate_quickly (NMDevice *self) { - g_return_val_if_fail (self != NULL, FALSE); + NMDevicePrivate *priv; + + g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); + + priv = NM_DEVICE_GET_PRIVATE (self); nm_system_shutdown_nis (); - if (nm_device_is_activating (self)) - nm_device_activation_cancel (self); + /* Break the activation chain */ + if (priv->act_source_id) { + g_source_remove (priv->act_source_id); + priv->act_source_id = 0; + } /* Stop any ongoing DHCP transaction on this device */ if (nm_device_get_act_request (self) && nm_device_get_use_dhcp (self)) { - nm_dhcp_manager_cancel_transaction (NM_DEVICE_GET_PRIVATE (self)->dhcp_manager, - nm_device_get_iface (self)); + nm_dhcp_manager_cancel_transaction (priv->dhcp_manager, nm_device_get_iface (self)); + nm_device_set_use_dhcp (self, FALSE); } - /* Tear down an existing activation request, which may not have happened - * in nm_device_activation_cancel() above, for various reasons. - */ + /* Tear down an existing activation request */ clear_act_request (self); /* Call device type-specific deactivation */ @@ -1723,7 +1682,6 @@ nm_device_class_init (NMDeviceClass *klass) object_class->constructor = constructor; klass->is_up = real_is_up; - klass->activation_cancel_handler = real_activation_cancel_handler; klass->get_type_capabilities = real_get_type_capabilities; klass->get_generic_capabilities = real_get_generic_capabilities; klass->act_stage1_prepare = real_act_stage1_prepare; diff --git a/src/nm-device.h b/src/nm-device.h index 68aded6b4a..27cca58ee9 100644 --- a/src/nm-device.h +++ b/src/nm-device.h @@ -99,8 +99,6 @@ struct _NMDeviceClass void (* deactivate) (NMDevice *self); void (* deactivate_quickly) (NMDevice *self); - void (* activation_cancel_handler) (NMDevice *self); - gboolean (* can_interrupt_activation) (NMDevice *self); }; @@ -149,8 +147,6 @@ void nm_device_activate_schedule_stage4_ip_config_get (NMDevice *device); void nm_device_activate_schedule_stage4_ip_config_timeout (NMDevice *device); gboolean nm_device_deactivate_quickly (NMDevice *dev); gboolean nm_device_is_activating (NMDevice *dev); -void nm_device_activation_cancel (NMDevice *dev); - gboolean nm_device_can_interrupt_activation (NMDevice *self); NMDeviceState nm_device_get_state (NMDevice *device);