- if (UNIT_IS_INACTIVE_OR_DEACTIVATING(os) && UNIT_IS_ACTIVE_OR_ACTIVATING(ns))
- retroactively_start_dependencies(u);
- else if (UNIT_IS_ACTIVE_OR_ACTIVATING(os) && UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
- retroactively_stop_dependencies(u);
+ if (unexpected) {
+ if (UNIT_IS_INACTIVE_OR_DEACTIVATING(os) && UNIT_IS_ACTIVE_OR_ACTIVATING(ns))
+ retroactively_start_dependencies(u);
+ else if (UNIT_IS_ACTIVE_OR_ACTIVATING(os) && UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
+ retroactively_stop_dependencies(u);
+ }
+
+ if (!UNIT_IS_ACTIVE_OR_RELOADING(os) && UNIT_IS_ACTIVE_OR_RELOADING(ns)) {
+
+ if (unit_has_name(u, SPECIAL_DBUS_SERVICE)) {
+ log_info("D-Bus became available, trying to reconnect.");
+ /* The bus just got started, hence try to connect to it. */
+ bus_init_system(u->meta.manager);
+ bus_init_api(u->meta.manager);
+ }
+
+ if (unit_has_name(u, SPECIAL_SYSLOG_SERVICE)) {
+ /* The syslog daemon just got started, hence try to connect to it. */
+ log_info("Syslog became available, trying to reconnect.");
+ log_open_syslog();
+ }
+
+ } else if (UNIT_IS_ACTIVE_OR_RELOADING(os) && !UNIT_IS_ACTIVE_OR_RELOADING(ns)) {
+
+ if (unit_has_name(u, SPECIAL_SYSLOG_SERVICE))
+ /* The syslog daemon just got terminated, hence try to disconnect from it. */
+ log_close_syslog();
+
+ /* We don't care about D-Bus here, since we'll get an
+ * asynchronous notification for it anyway. */
+ }