bus: add sd_bus_track object for tracking peers, and port core over to it

System Internals / systemd - Lennart Poettering [poettering.net] - 2 March 2014 19:34 UTC

This is primarily useful for services that need to track clients which reference certain objects they maintain, or which explicitly want to subscribe to certain events. Something like this is done in a large number of services, and not trivial to do. Hence, let's unify this at one place.

This also ports over PID 1 to use this to ensure that subscriptions to job and manager events are correctly tracked. As a side-effect this makes sure we properly serialize and restore the track list across daemon reexec/reload, which didn't work correctly before.

This also simplifies how we distribute messages to broadcast to the direct busses: we only track subscriptions for the API bus and implicitly assume that all direct busses are subscribed. This should be a pretty OK simplification since clients connected via direct bus connections are shortlived anyway.

8f8f05a bus: add sd_bus_track object for tracking peers, and port core over to it
Makefile.am | 4 +-
src/core/dbus-client-track.c | 251 ---------------------------
src/core/dbus-client-track.h | 42 -----
src/core/dbus-job.c | 64 ++-----
src/core/dbus-manager.c | 99 +++++------
src/core/dbus-manager.h | 2 -
src/core/dbus-unit.c | 34 ++--
src/core/dbus.c | 95 ++++++++--
src/core/dbus.h | 7 +-
src/core/job.c | 22 ++-
src/core/job.h | 3 +-
src/core/manager.c | 11 +-
src/core/manager.h | 8 +-
src/core/unit.c | 3 +-
src/libsystemd/libsystemd.sym.m4 | 12 ++
src/libsystemd/sd-bus/bus-internal.h | 2 +
src/libsystemd/sd-bus/bus-track.c | 314 ++++++++++++++++++++++++++++++++++
src/libsystemd/sd-bus/bus-track.h | 24 +++
src/libsystemd/sd-bus/sd-bus.c | 22 +++
src/systemd/sd-bus.h | 19 ++
20 files changed, 592 insertions(+), 446 deletions(-)

Upstream: github.com


  • Share