]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/unit.c
core: rework how we connect to the bus
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Feb 2018 13:52:22 +0000 (14:52 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 12 Feb 2018 10:34:00 +0000 (11:34 +0100)
commit8559b3b75cbd04ec132f55bdb61eae7faf27d6fc
treebe456ff4e2fb0c2df62d41361264430c040d0c9e
parent4502c403995df57c15b5c3d4b55ea58f24e2c0cc
core: rework how we connect to the bus

This removes the current bus_init() call, as it had multiple problems:
it munged  handling of the three bus connections we care about (private,
"api" and system) into one, even though the conditions when which was
ready are very different. It also added redundant logging, as the
individual calls it called all logged on their own anyway.

The three calls bus_init_api(), bus_init_private() and bus_init_system()
are now made public. A new call manager_dbus_is_running() is added that
works much like manager_journal_is_running() and is a lot more careful
when checking whether dbus is around. Optionally it checks the unit's
deserialized_state rather than state, in order to accomodate for cases
where we cant to connect to the bus before deserializing the
"subscribed" list, before coldplugging the units.

manager_recheck_dbus() is added, that works a lot like
manager_recheck_journal() and is invoked in unit_notify(), i.e. when
units change state.

All in all this should make handling a bit more alike to journal
handling, and it also fixes one major bug: when running in user mode
we'll now connect to the system bus early on, without conditionalizing
this in anyway.
src/core/dbus.c
src/core/dbus.h
src/core/manager.c
src/core/manager.h
src/core/unit.c