about summary refs log tree commit diff
path: root/libnm/nm-active-connection.c
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2020-02-26 16:25:55 +0100
committerSebastien Bacher <seb128@ubuntu.com>2020-02-26 16:25:55 +0100
commitee7b95167028fdbb2a4bd32aa686e27817d8dfe0 (patch)
treef7a1abab0400789979f860dda724247a9bbbdef1 /libnm/nm-active-connection.c
parentc1b3616485604f3fddfad9521cb8818cd8eece2b (diff)
parente536d40eaea5dcdc0743b0a5e8e17faa46608a50 (diff)
Merge branch 'upstream/latest' of https://salsa.debian.org/utopia-team/network-manager into upstream/latest
Diffstat (limited to 'libnm/nm-active-connection.c')
-rw-r--r--libnm/nm-active-connection.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c
index aa8504e6..ade2edbe 100644
--- a/libnm/nm-active-connection.c
+++ b/libnm/nm-active-connection.c
@@ -425,6 +425,33 @@ _nm_active_connection_state_changed_commit (NMActiveConnection *self,
 	                                        _notify_event_state_changed,
 	                                        g_object_ref (self));
 }
+/*****************************************************************************/
+
+static gboolean
+is_ready (NMObject *nmobj)
+{
+	NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (nmobj);
+
+	/* Usually, we don't want to expose our NMObject instances until they are fully initialized.
+	 * For NMRemoteSetting this means to wait until GetSettings() returns.
+	 *
+	 * Note that most object types reference each other (directly or indirectly). E.g. the
+	 * NMActiveConnection refers to the NMRemoteConnection and the NMDevice instance. So,
+	 * we don't want to hide them too long, otherwise basically the entire set of objects
+	 * will be hidden until they are all initialized. So, usually, when a NMObject references
+	 * objects that are not yet initialized, that reference will just be NULL but the object
+	 * will be considered ready already.
+	 *
+	 * For NMActiveConnection referencing a NMRemoteConnection don't do that. Here we wait for the
+	 * NMRemoteConnection to be ready as well. This is somewhat arbitrary special casing, but
+	 * the effect is that when nm_client_add_and_activate*() returns, the NMActiveConnection already
+	 * references a initialized NMRemoteConnection.
+	 */
+	if (!nml_dbus_property_o_is_ready_fully (&priv->property_o[PROPERTY_O_IDX_CONNECTION]))
+		return FALSE;
+
+	return NM_OBJECT_CLASS (nm_active_connection_parent_class)->is_ready (nmobj);
+}
 
 /*****************************************************************************/
 
@@ -550,6 +577,8 @@ nm_active_connection_class_init (NMActiveConnectionClass *klass)
 	object_class->get_property = get_property;
 	object_class->finalize     = finalize;
 
+	nm_object_class->is_ready = is_ready;
+
 	_NM_OBJECT_CLASS_INIT_PRIV_PTR_INDIRECT (nm_object_class, NMActiveConnection);
 
 	_NM_OBJECT_CLASS_INIT_PROPERTY_O_FIELDS_N (nm_object_class, NMActiveConnectionPrivate, property_o);