NetworkManager r3920 - in trunk: . libnm-glib
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3920 - in trunk: . libnm-glib
- Date: Mon, 11 Aug 2008 01:47:09 +0000 (UTC)
Author: dcbw
Date: Mon Aug 11 01:47:09 2008
New Revision: 3920
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3920&view=rev
Log:
2008-08-10 Dan Williams <dcbw redhat com>
* libnm-glib/nm-vpn-plugin.c
- (nm_vpn_plugin_connect): stop plugin after connection failure from
an idle handler so the Connect reply gets delivered before the
stop StateChanged signal
Modified:
trunk/ChangeLog
trunk/libnm-glib/nm-vpn-plugin.c
Modified: trunk/libnm-glib/nm-vpn-plugin.c
==============================================================================
--- trunk/libnm-glib/nm-vpn-plugin.c (original)
+++ trunk/libnm-glib/nm-vpn-plugin.c Mon Aug 11 01:47:09 2008
@@ -46,6 +46,7 @@
/* Temporary stuff */
guint connect_timer;
guint quit_timer;
+ guint fail_stop_id;
} NMVPNPluginPrivate;
#define NM_VPN_PLUGIN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_VPN_PLUGIN, NMVPNPluginPrivate))
@@ -257,10 +258,20 @@
}
static gboolean
+fail_stop (gpointer data)
+{
+ NMVPNPlugin *plugin = NM_VPN_PLUGIN (data);
+
+ nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STOPPED);
+ return FALSE;
+}
+
+static gboolean
nm_vpn_plugin_connect (NMVPNPlugin *plugin,
NMConnection *connection,
GError **err)
{
+ NMVPNPluginPrivate *priv = NM_VPN_PLUGIN_GET_PRIVATE (plugin);
gboolean ret = FALSE;
NMVPNServiceState state;
@@ -293,8 +304,14 @@
case NM_VPN_SERVICE_STATE_INIT:
nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STARTING);
ret = NM_VPN_PLUGIN_GET_CLASS (plugin)->connect (plugin, connection, err);
- if (!ret)
- nm_vpn_plugin_set_state (plugin, NM_VPN_SERVICE_STATE_STOPPED);
+ if (!ret) {
+ /* Stop the plugin from and idle handler so that the Connect
+ * method return gets sent before the STOP StateChanged signal.
+ */
+ if (priv->fail_stop_id)
+ g_source_remove (priv->fail_stop_id);
+ priv->fail_stop_id = g_idle_add (fail_stop, plugin);
+ }
break;
default:
@@ -584,6 +601,9 @@
priv->disposed = TRUE;
+ if (priv->fail_stop_id)
+ g_source_remove (priv->fail_stop_id);
+
state = nm_vpn_plugin_get_state (plugin);
if (state == NM_VPN_SERVICE_STATE_STARTED ||
@@ -633,6 +653,11 @@
if (priv->quit_timer)
g_source_remove (priv->quit_timer);
+ if (priv->fail_stop_id) {
+ g_source_remove (priv->fail_stop_id);
+ priv->fail_stop_id = 0;
+ }
+
/* Add a timer to make sure we do not wait indefinitely for the successful connect. */
priv->connect_timer = g_timeout_add_full (G_PRIORITY_DEFAULT,
NM_VPN_PLUGIN_CONNECT_TIMER,
@@ -655,6 +680,10 @@
if (priv->quit_timer)
g_source_remove (priv->quit_timer);
+ if (priv->fail_stop_id) {
+ g_source_remove (priv->fail_stop_id);
+ priv->fail_stop_id = 0;
+ }
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]