chiark / gitweb /
dbus: don't try to connect to the system bus before it is actually up
authorLennart Poettering <lennart@poettering.net>
Thu, 20 Jan 2011 18:43:38 +0000 (19:43 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 20 Jan 2011 18:43:38 +0000 (19:43 +0100)
TODO
src/dbus.c
src/dbus.h
src/manager.c
src/unit.c

diff --git a/TODO b/TODO
index 4e8c6d1bb5eadd20b6a1074787f95c5b5c7b1f03..57802a6555b3f7d7fa808e3279f16d57b82732aa 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,7 +1,5 @@
 Bugs:
 
-* Don't try to connect to dbus during early boot
-
 * sometimes processes seem to remain when we kill a service
   http://lists.fedoraproject.org/pipermail/devel/2011-January/147559.html
 
index 48051f25fb76f79ebfa93def6153f371d0f346c7..d7b80ba01d17c9bbe8d31ad368b179784c349f11 100644 (file)
@@ -982,7 +982,7 @@ fail:
         return r;
 }
 
-int bus_init(Manager *m) {
+int bus_init(Manager *m, bool try_bus_connect) {
         int r;
 
         if (set_ensure_allocated(&m->bus_connections, trivial_hash_func, trivial_compare_func) < 0 ||
@@ -1003,9 +1003,13 @@ int bus_init(Manager *m) {
                         return -ENOMEM;
                 }
 
-        if ((r = bus_init_system(m)) < 0 ||
-            (r = bus_init_api(m)) < 0 ||
-            (r = bus_init_private(m)) < 0)
+        if (try_bus_connect) {
+                if ((r = bus_init_system(m)) < 0 ||
+                    (r = bus_init_api(m)) < 0)
+                        return r;
+        }
+
+        if ((r = bus_init_private(m)) < 0)
                 return r;
 
         return 0;
index 7c0da3320b33714749db9ee17af8fb1b1aa79c5b..d0a9e8e30fcb4f7c2675212102e76c68bc2decd6 100644 (file)
@@ -69,7 +69,7 @@ typedef struct BusProperty {
         " </method>\n"                                                  \
         "</interface>\n"
 
-int bus_init(Manager *m);
+int bus_init(Manager *m, bool try_bus_connect);
 void bus_done(Manager *m);
 
 unsigned bus_dispatch(Manager *m);
index 62847061a27319be99daebe533c49afd0352d20e..013b26b6c965ad95b64ae3334e1cf1a8f74d7d1f 100644 (file)
@@ -259,7 +259,7 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) {
                 goto fail;
 
         /* Try to connect to the busses, if possible. */
-        if ((r = bus_init(m)) < 0)
+        if ((r = bus_init(m, running_as != MANAGER_SYSTEM)) < 0)
                 goto fail;
 
 #ifdef HAVE_AUDIT
@@ -2102,7 +2102,7 @@ static int manager_process_signal_fd(Manager *m) {
 
                         if (!u || UNIT_IS_ACTIVE_OR_RELOADING(unit_active_state(u))) {
                                 log_info("Trying to reconnect to bus...");
-                                bus_init(m);
+                                bus_init(m, true);
                         }
 
                         if (!u || !UNIT_IS_ACTIVE_OR_ACTIVATING(unit_active_state(u))) {
index 9dd02676e385829e2d5d82a8c38f4c6b42d1057a..a7e6714c4508a5855d8d1158ab780fa3de06e714 100644 (file)
@@ -1194,7 +1194,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
                         /* The bus just might have become available,
                          * hence try to connect to it, if we aren't
                          * yet connected. */
-                        bus_init(u->meta.manager);
+                        bus_init(u->meta.manager, true);
 
                 if (unit_has_name(u, SPECIAL_SYSLOG_SERVICE))
                         /* The syslog daemon just might have become