mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 15:20:19 +01:00
libnm: merge branch 'th/libnm-active-connection-delay-ready'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/405
This commit is contained in:
commit
2d3a1af5d6
3 changed files with 42 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1283,7 +1283,7 @@ nml_dbus_object_obj_changed_link (NMClient *self,
|
|||
nm_assert (changed_type != NML_DBUS_OBJ_CHANGED_TYPE_NONE);
|
||||
|
||||
if (!NM_FLAGS_ALL ((NMLDBusObjChangedType ) dbobj->obj_changed_type, changed_type))
|
||||
NML_NMCLIENT_LOG_T (self, "[%s] changed-type 0x%02x linked", dbobj->dbus_path->str, (guint) changed_type);
|
||||
NML_NMCLIENT_LOG_T (self, "[%s]: changed-type 0x%02x linked", dbobj->dbus_path->str, (guint) changed_type);
|
||||
|
||||
if (dbobj->obj_changed_type == NML_DBUS_OBJ_CHANGED_TYPE_NONE) {
|
||||
NMClientPrivate *priv;
|
||||
|
|
@ -1329,7 +1329,7 @@ nml_dbus_object_obj_changed_consume (NMClient *self,
|
|||
if (dbobj->obj_changed_type == NML_DBUS_OBJ_CHANGED_TYPE_NONE) {
|
||||
c_list_unlink (&dbobj->obj_changed_lst);
|
||||
nm_assert (changed_type_res != NML_DBUS_OBJ_CHANGED_TYPE_NONE);
|
||||
NML_NMCLIENT_LOG_T (self, "[%s] changed-type 0x%02x consumed", dbobj->dbus_path->str, (guint) changed_type_res);
|
||||
NML_NMCLIENT_LOG_T (self, "[%s]: changed-type 0x%02x consumed", dbobj->dbus_path->str, (guint) changed_type_res);
|
||||
return changed_type_res;
|
||||
}
|
||||
|
||||
|
|
@ -1337,7 +1337,7 @@ nml_dbus_object_obj_changed_consume (NMClient *self,
|
|||
|
||||
nm_assert (!c_list_contains (&priv->obj_changed_lst_head, &dbobj->obj_changed_lst));
|
||||
nm_c_list_move_tail (&priv->obj_changed_lst_head, &dbobj->obj_changed_lst);
|
||||
NML_NMCLIENT_LOG_T (self, "[%s] changed-type 0x%02x consumed (still has 0x%02x)", dbobj->dbus_path->str, (guint) changed_type_res, (guint) dbobj->obj_changed_type);
|
||||
NML_NMCLIENT_LOG_T (self, "[%s]: changed-type 0x%02x consumed (still has 0x%02x)", dbobj->dbus_path->str, (guint) changed_type_res, (guint) dbobj->obj_changed_type);
|
||||
return changed_type_res;
|
||||
}
|
||||
|
||||
|
|
@ -1594,6 +1594,14 @@ nml_dbus_property_o_is_ready (const NMLDBusPropertyO *pr_o)
|
|||
|| !pr_o->owner_dbobj;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nml_dbus_property_o_is_ready_fully (const NMLDBusPropertyO *pr_o)
|
||||
{
|
||||
return !pr_o->owner_dbobj
|
||||
|| !pr_o->obj_watcher
|
||||
|| pr_o->nmobj;
|
||||
}
|
||||
|
||||
static void
|
||||
nml_dbus_property_o_notify_changed (NMLDBusPropertyO *pr_o,
|
||||
NMClient *self)
|
||||
|
|
|
|||
|
|
@ -260,6 +260,8 @@ gpointer nml_dbus_property_o_get_obj (NMLDBusPropertyO *pr_o);
|
|||
|
||||
gboolean nml_dbus_property_o_is_ready (const NMLDBusPropertyO *pr_o);
|
||||
|
||||
gboolean nml_dbus_property_o_is_ready_fully (const NMLDBusPropertyO *pr_o);
|
||||
|
||||
void nml_dbus_property_o_clear (NMLDBusPropertyO *pr_o,
|
||||
NMClient *client);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue