NetworkManager r3285 - in trunk: . src/supplicant-manager



Author: dcbw
Date: Mon Feb  4 15:24:18 2008
New Revision: 3285
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3285&view=rev

Log:
2008-02-04  Dan Williams  <dcbw redhat com>

	* src/supplicant-manager/nm-supplicant-manager.c
		- (poke_supplicant_cb): reschedule the poke as a timeout, don't let
			glib automatically reschedule
		- (nm_supplicant_manager_init): immediately try to start the supplicant
		- (nm_supplicant_manager_name_owner_changed): immediately try to restart
			the supplicant



Modified:
   trunk/ChangeLog
   trunk/src/supplicant-manager/nm-supplicant-manager.c

Modified: trunk/src/supplicant-manager/nm-supplicant-manager.c
==============================================================================
--- trunk/src/supplicant-manager/nm-supplicant-manager.c	(original)
+++ trunk/src/supplicant-manager/nm-supplicant-manager.c	Mon Feb  4 15:24:18 2008
@@ -29,7 +29,7 @@
 #include "nm-marshal.h"
 #include "nm-utils.h"
 
-#define SUPPLICANT_POKE_INTERVAL 6000
+#define SUPPLICANT_POKE_INTERVAL 120000
 
 typedef struct {
 	NMDBusManager *	dbus_mgr;
@@ -97,14 +97,20 @@
 	                                   WPAS_DBUS_INTERFACE);
 	if (!proxy) {
 		nm_warning ("Error: could not init wpa_supplicant proxy");
-		return TRUE;
+		goto out;
 	}
 
 	nm_info ("Trying to start the supplicant...");
 	dbus_g_proxy_call_no_reply (proxy, "getInterface", G_TYPE_STRING, tmp, G_TYPE_INVALID);
 	g_object_unref (proxy);
 
-	return TRUE;
+out:
+	/* Reschedule the poke */	
+	priv->poke_id = g_timeout_add (SUPPLICANT_POKE_INTERVAL,
+	                               poke_supplicant_cb,
+	                               (gpointer) self);
+
+	return FALSE;
 }
 
 static void
@@ -126,12 +132,8 @@
 	                  self);
 
 	if (!running) {
-		/* Poke the supplicant so that it gets activated by dbus system bus
-		 * activation.
-		 */
-		priv->poke_id = g_timeout_add (SUPPLICANT_POKE_INTERVAL,
-		                               poke_supplicant_cb,
-		                               (gpointer) self);
+		/* Try to activate the supplicant */
+		priv->poke_id = g_idle_add (poke_supplicant_cb, (gpointer) self);
 	}
 }
 
@@ -209,14 +211,13 @@
 	} else if (old_owner_good && !new_owner_good) {
 		nm_supplicant_manager_set_state (self, NM_SUPPLICANT_MANAGER_STATE_DOWN);
 
-		if (!priv->poke_id) {
-			/* Poke the supplicant so that it gets activated by dbus system bus
-			 * activation.
-			 */
-			priv->poke_id = g_timeout_add (SUPPLICANT_POKE_INTERVAL,
-			                               poke_supplicant_cb,
-			                               (gpointer) self);
-		}
+		if (priv->poke_id)
+			g_source_remove (priv->poke_id);
+
+		/* Poke the supplicant so that it gets activated by dbus system bus
+		 * activation.
+		 */
+		priv->poke_id = g_idle_add (poke_supplicant_cb, (gpointer) self);
 	}
 }
 



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