NetworkManager r3471 - in trunk: . src



Author: tambeti
Date: Mon Mar 17 20:59:54 2008
New Revision: 3471
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3471&view=rev

Log:
Author: Tambet Ingo <tambet gmail com>
Date:   Mon Mar 17 12:27:01 2008 -0600

    2008-03-17  Tambet Ingo  <tambet gmail com>

    	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().


Modified:
   trunk/ChangeLog
   trunk/src/nm-device-802-11-wireless.c
   trunk/src/nm-device.c
   trunk/src/nm-device.h

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	Mon Mar 17 20:59:54 2008
@@ -2902,26 +2902,6 @@
 	         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 @@
 	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,

Modified: trunk/src/nm-device.c
==============================================================================
--- trunk/src/nm-device.c	(original)
+++ trunk/src/nm-device.c	Mon Mar 17 20:59:54 2008
@@ -989,52 +989,6 @@
 	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 @@
 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 @@
 	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;

Modified: trunk/src/nm-device.h
==============================================================================
--- trunk/src/nm-device.h	(original)
+++ trunk/src/nm-device.h	Mon Mar 17 20:59:54 2008
@@ -99,8 +99,6 @@
 	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_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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]