summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-06-06 15:30:24 -0400
committerDan Winship <danw@gnome.org>2014-06-06 15:33:03 -0400
commitc4ca23137e178b485dd9a70740534e9f76d86b6c (patch)
tree60b93148bb735b451f4133ed906f909396a7e7e6
parent67b228d16bf8523e37c36f45d48da406ba5b461e (diff)
downloadNetworkManager-c4ca23137e178b485dd9a70740534e9f76d86b6c.tar.gz
core: fix lag in NMManager:state moving to CONNECTED_GLOBAL
Something changed at some point so that NMManager was now recomputing its state after a connection was activated, but before NMPolicy had decided whether to give that connection the default route, meaning NMManager would set the state to CONNECTED_LOCAL rather than CONNECTED_GLOBAL. Fix this by watching the active connection :default and :default6 properties too, so we do the right thing regardless of what order the AC properties change in.
-rw-r--r--src/nm-manager.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 6fc74df14a..1b7c87e25d 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -276,6 +276,9 @@ nm_manager_error_quark (void)
static void active_connection_state_changed (NMActiveConnection *active,
GParamSpec *pspec,
NMManager *self);
+static void active_connection_default_changed (NMActiveConnection *active,
+ GParamSpec *pspec,
+ NMManager *self);
/* Returns: whether to notify D-Bus of the removal or not */
static gboolean
@@ -291,6 +294,7 @@ active_connection_remove (NMManager *self, NMActiveConnection *active)
priv->active_connections = g_slist_remove (priv->active_connections, active);
g_signal_emit (self, signals[ACTIVE_CONNECTION_REMOVED], 0, active);
g_signal_handlers_disconnect_by_func (active, active_connection_state_changed, self);
+ g_signal_handlers_disconnect_by_func (active, active_connection_default_changed, self);
g_object_unref (active);
}
@@ -344,6 +348,14 @@ active_connection_state_changed (NMActiveConnection *active,
nm_manager_update_state (self);
}
+static void
+active_connection_default_changed (NMActiveConnection *active,
+ GParamSpec *pspec,
+ NMManager *self)
+{
+ nm_manager_update_state (self);
+}
+
/**
* active_connection_add():
* @self: the #NMManager
@@ -365,6 +377,14 @@ active_connection_add (NMManager *self, NMActiveConnection *active)
"notify::" NM_ACTIVE_CONNECTION_STATE,
G_CALLBACK (active_connection_state_changed),
self);
+ g_signal_connect (active,
+ "notify::" NM_ACTIVE_CONNECTION_DEFAULT,
+ G_CALLBACK (active_connection_default_changed),
+ self);
+ g_signal_connect (active,
+ "notify::" NM_ACTIVE_CONNECTION_DEFAULT6,
+ G_CALLBACK (active_connection_default_changed),
+ self);
g_signal_emit (self, signals[ACTIVE_CONNECTION_ADDED], 0, active);