[PATCH 0.9.8] core: emit Manager ActiveConnections before Device ActiveConnection

2014-03-18 Thread Dan Williams
When activating a connection, the Device object's ActiveConnection
property was emitted before the object was added to the Manager's
active connection list, and thus before the Manager emitted a
change signal for the ActiveConnections property.  That's the
opposite order from what it should be; the manager should know
about the AC before the device starts using it.
---
 src/nm-manager.c | 58 +---
 1 file changed, 26 insertions(+), 32 deletions(-)

diff --git a/src/nm-manager.c b/src/nm-manager.c
index 2cd210b..653dd4f 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -2004,17 +2004,15 @@ add_device (NMManager *self, NMDevice *device)
NMActiveConnection *ac;
GError *error = NULL;
 
nm_log_dbg (LOGD_DEVICE, "(%s): will attempt to assume existing 
connection",
nm_device_get_iface (device));
 
ac = internal_activate_device (self, device, existing, NULL, 
FALSE, 0, NULL, TRUE, NULL, &error);
-   if (ac)
-   active_connection_add (self, ac);
-   else {
+   if (!ac) {
nm_log_warn (LOGD_DEVICE, "assumed connection %s failed 
to activate: (%d) %s",
 nm_connection_get_path (existing),
 error ? error->code : -1,
 error && error->message ? error->message : 
"(unknown)");
g_error_free (error);
}
}
@@ -2515,14 +2513,15 @@ internal_activate_device (NMManager *manager,
  user_requested,
  sender_uid,
  dbus_sender,
  assumed,
  device,
  master_device);
g_assert (req);
+   active_connection_add (manager, NM_ACTIVE_CONNECTION (req));
nm_device_activate (device, req);
 
return NM_ACTIVE_CONNECTION (req);
 }
 
 /**
  * find_master:
@@ -2792,15 +2791,15 @@ static NMActiveConnection *
 activate_vpn_connection (NMManager *self,
  NMConnection *connection,
  const char *specific_object,
  gulong sender_uid,
  GError **error)
 {
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
-   NMActiveConnection *parent = NULL;
+   NMActiveConnection *parent = NULL, *ac;
NMDevice *device = NULL;
GSList *iter;
 
if (specific_object) {
/* Find the specifc connection the client requested we use */
parent = active_connection_get_by_path (self, specific_object);
if (!parent) {
@@ -2828,21 +2827,24 @@ activate_vpn_connection (NMManager *self,
device = nm_active_connection_get_device (parent);
if (!device) {
g_set_error_literal (error, NM_MANAGER_ERROR, 
NM_MANAGER_ERROR_UNKNOWN_DEVICE,
 "Source connection had no active device.");
return NULL;
}
 
-   return nm_vpn_manager_activate_connection (priv->vpn_manager,
-  connection,
-  device,
-  
nm_active_connection_get_path (parent),
-  TRUE,
-  sender_uid,
-  error);
+   ac = nm_vpn_manager_activate_connection (priv->vpn_manager,
+connection,
+device,
+nm_active_connection_get_path 
(parent),
+TRUE,
+sender_uid,
+error);
+   if (ac)
+   active_connection_add (self, ac);
+   return ac;
 }
 
 NMActiveConnection *
 nm_manager_activate_connection (NMManager *manager,
 NMConnection *connection,
 const char *specific_object,
 const char *device_path,
@@ -2853,15 +2855,15 @@ nm_manager_activate_connection (NMManager *manager,
NMDevice *device = NULL;
gulong sender_uid = 0;
DBusError dbus_error;
NMDeviceState state;
char *iface;
NMDevice *master_device = NULL;
NMConnection *master_connection = NULL;
-   NMActiveConnection *master_ac = NULL, *ac = NULL;
+   NMActiveConnection *master_ac = NULL;
gboolean matched;
 
g_return_val_if_fail (manager != NULL, NULL);
g_retu

Re: [PATCH 0.9.8] core: emit Manager ActiveConnections before Device ActiveConnection

2014-03-19 Thread Thomas Haller
On Tue, 2014-03-18 at 17:16 -0500, Dan Williams wrote:
> When activating a connection, the Device object's ActiveConnection
> property was emitted before the object was added to the Manager's
> active connection list, and thus before the Manager emitted a
> change signal for the ActiveConnections property.  That's the
> opposite order from what it should be; the manager should know
> about the AC before the device starts using it.
> ---

Acked-by: Thomas Haller 


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list