From 3cde9e8fa0ae2a424ae2e6e27e14668ca5d90c98 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 5 Aug 2015 15:58:39 +0200 Subject: logind: switch to sd_bus_track helper Let logind use the sd_bus_track helper object to track the controllers of sessions. This does not only remove quite some code but also kills the unconditional matches for all NameOwnerChanged signals. The latter is something we should never ever do, as it wakes up the daemon every time a client connects, which doesn't scale. --- src/login/logind.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'src/login/logind.c') diff --git a/src/login/logind.c b/src/login/logind.c index e2fb496289..49a2811842 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -76,10 +76,7 @@ static Manager *manager_new(void) { m->user_units = hashmap_new(&string_hash_ops); m->session_units = hashmap_new(&string_hash_ops); - m->busnames = set_new(&string_hash_ops); - - if (!m->devices || !m->seats || !m->sessions || !m->users || !m->inhibitors || !m->buttons || !m->busnames || - !m->user_units || !m->session_units) + if (!m->devices || !m->seats || !m->sessions || !m->users || !m->inhibitors || !m->buttons || !m->user_units || !m->session_units) goto fail; m->kill_exclude_users = strv_new("root", NULL); @@ -141,8 +138,6 @@ static void manager_free(Manager *m) { hashmap_free(m->user_units); hashmap_free(m->session_units); - set_free_free(m->busnames); - sd_event_source_unref(m->idle_action_event_source); sd_event_source_unref(m->inhibit_timeout_source); sd_event_source_unref(m->scheduled_shutdown_timeout_source); @@ -626,17 +621,6 @@ static int manager_connect_bus(Manager *m) { if (r < 0) return log_error_errno(r, "Failed to add user enumerator: %m"); - r = sd_bus_add_match(m->bus, - NULL, - "type='signal'," - "sender='org.freedesktop.DBus'," - "interface='org.freedesktop.DBus'," - "member='NameOwnerChanged'," - "path='/org/freedesktop/DBus'", - match_name_owner_changed, m); - if (r < 0) - return log_error_errno(r, "Failed to add match for NameOwnerChanged: %m"); - r = sd_bus_add_match(m->bus, NULL, "type='signal'," -- cgit v1.2.3-54-g00ecf