NetworkManager r3774 - in trunk: . src



Author: dcbw
Date: Thu Jun 26 17:53:35 2008
New Revision: 3774
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3774&view=rev

Log:
2008-06-26  Dan Williams <dcbw redhat com>

	Patch from Adel Gadllah <adel gadllah gmail com>

	* src/nm-device-wifi.c
		- (link_timeout_cb): don't ignore disconnects due to scanning
		- (supplicant_iface_connection_state_cb_handler): instead, schedule
			a longer timeout when scanning; avoids case where supplicant can't
			find the AP and just keeps scanning forever but isn't connected



Modified:
   trunk/ChangeLog
   trunk/src/nm-device-wifi.c

Modified: trunk/src/nm-device-wifi.c
==============================================================================
--- trunk/src/nm-device-wifi.c	(original)
+++ trunk/src/nm-device-wifi.c	Thu Jun 26 17:53:35 2008
@@ -1951,10 +1951,6 @@
 
 	g_assert (dev);
 
-	/* If currently scanning and disconnected still, check again later. */
-	if (priv->scanning)
-		return TRUE;
-
 	priv->link_timeout_id = 0;
 
 	req = nm_device_get_act_request (dev);
@@ -2110,19 +2106,14 @@
 static gboolean
 supplicant_iface_connection_state_cb_handler (gpointer user_data)
 {
-	struct state_cb_data *  cb_data = (struct state_cb_data *) user_data;
-	NMDeviceWifi * self;
-	NMDevice *              dev;
-	guint32                 new_state, old_state;
-
-	g_return_val_if_fail (cb_data != NULL, FALSE);
-
-	self = cb_data->self;
-	dev = NM_DEVICE (self);
-	new_state = cb_data->new_state;
-	old_state = cb_data->old_state;
+	struct state_cb_data *cb_data = (struct state_cb_data *) user_data;
+	NMDeviceWifi *self = cb_data->self;
+	NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
+	NMDevice *dev = NM_DEVICE (self);
+	guint32 new_state = cb_data->new_state;
+	guint32 old_state = cb_data->old_state;
 
-	if (!nm_device_get_act_request (NM_DEVICE (self))) {
+	if (!nm_device_get_act_request (dev)) {
 		/* The device is not activating or already activated; do nothing. */
 		goto out;
 	}
@@ -2130,6 +2121,8 @@
 	nm_info ("(%s): supplicant connection state change: %d -> %d",
 	         nm_device_get_iface (dev), old_state, new_state);
 
+	priv->scanning = (new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_SCANNING);
+
 	if (new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_COMPLETED) {
 		remove_supplicant_interface_connection_error_handler (self);
 		remove_supplicant_timeouts (self);
@@ -2149,18 +2142,17 @@
 		}
 	} else if (new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_DISCONNECTED) {
 		if (nm_device_get_state (dev) == NM_DEVICE_STATE_ACTIVATED || nm_device_is_activating (dev)) {
-			/* Start the link timeout so we allow some time for reauthentication */
-			if (!self->priv->link_timeout_id)
-				self->priv->link_timeout_id = g_timeout_add (15000, link_timeout_cb, self);
+			/* Start the link timeout so we allow some time for reauthentication,
+			 * use a longer timeout if we are scanning since some cards take a
+			 * while to scan.
+			 */
+			if (!priv->link_timeout_id) {
+				priv->link_timeout_id = g_timeout_add (priv->scanning ? 30000 : 15000,
+				                                       link_timeout_cb, self);
+			}
 		}
 	}
 
-	if (new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_SCANNING) {
-		self->priv->scanning = TRUE;
-	} else {
-		self->priv->scanning = FALSE;
-	}
-
 out:
 	g_slice_free (struct state_cb_data, cb_data);
 	return FALSE;



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