diff options
| author | Michael Biebl <biebl@debian.org> | 2020-08-19 10:13:49 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2020-08-19 10:13:49 +0200 |
| commit | e7b44ef4c80907346ec7492a09c45277459924fc (patch) | |
| tree | b1388af193ca205f73336eca47e81815e43a61ca /src/nm-manager.c | |
| parent | 136d191f1c96dbae1489fed7c2565f5e1b1f8d40 (diff) | |
New upstream version 1.26.2 upstream/1.26.2
Diffstat (limited to 'src/nm-manager.c')
| -rw-r--r-- | src/nm-manager.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 92112532..778e3b94 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1561,13 +1561,6 @@ check_if_startup_complete (NMManager *self) if (!priv->devices_inited) return; - reason = nm_settings_get_startup_complete_blocked_reason (priv->settings); - if (reason) { - _LOGD (LOGD_CORE, "startup complete is waiting for connection (%s)", - reason); - return; - } - c_list_for_each_entry (device, &priv->devices_lst_head, devices_lst) { reason = nm_device_has_pending_action_reason (device); if (reason) { @@ -1578,6 +1571,31 @@ check_if_startup_complete (NMManager *self) } } + /* All NMDevice must be ready. But also NMSettings tracks profiles that wait for + * ready devices via "connection.wait-device-timeout". + * + * Note that we only re-check nm_settings_get_startup_complete_blocked_reason() when + * all of the devices become ready (again). + * + * For example, assume we have device "eth1" and "profile-eth2" which waits for "eth2". + * If "eth1" is ready (no pending action), we only need to re-evaluate "profile-eth2" + * if we have another device ("eth2"), that becomes non-ready (had pending actions) + * and again become ready. We don't need to check "profile-eth2" until "eth2" becomes + * non-ready. + * That is why nm_settings_get_startup_complete_blocked_reason() only has any significance + * if all devices are ready too. It allows us to cut down the number of checks whether + * NMSettings is ready. That's because we don't need to re-evaluate on minor changes of + * a device, only when all devices become managed and ready. */ + + g_signal_handlers_block_by_func (priv->settings, settings_startup_complete_changed, self); + reason = nm_settings_get_startup_complete_blocked_reason (priv->settings, TRUE); + g_signal_handlers_unblock_by_func (priv->settings, settings_startup_complete_changed, self); + if (reason) { + _LOGD (LOGD_CORE, "startup complete is waiting for connection (%s)", + reason); + return; + } + _LOGI (LOGD_CORE, "startup complete"); priv->startup = FALSE; @@ -6048,8 +6066,9 @@ do_sleep_wake (NMManager *self, gboolean sleeping_changed) } else { _LOGD (LOGD_SUSPEND, "sleep: %s...", waking_from_suspend ? "waking up" : "re-enabling"); + sleep_devices_clear (self); + if (waking_from_suspend) { - sleep_devices_clear (self); c_list_for_each_entry (device, &priv->devices_lst_head, devices_lst) { if (nm_device_is_software (device)) continue; @@ -7454,7 +7473,7 @@ constructed (GObject *object) G_OBJECT_CLASS (nm_manager_parent_class)->constructed (object); - priv->settings = nm_settings_new (); + priv->settings = nm_settings_new (self); nm_dbus_object_export (NM_DBUS_OBJECT (priv->settings)); |