Skip to content

Commit

Permalink
Sessions monitor should watch only changes in sessions
Browse files Browse the repository at this point in the history
Currently, the polkitbackendsessionmonitor watches all notifications from
sd-login-monitor. This causes waking polkit even four+ times on every
login/logout and starting a train of action re-verification several
times for each instantiated PolkitAuthority (e.g. applets on gnome-shell
panel that utilize PolkitPermission).
This is not necessary, because polkit only needs to watch for sessions
that change status from active to online and vice-versa (to maintain
security for actions that have is_active defined).
This still doesn't resolve the problem completely, but at least halves
the impact on system resources.
  • Loading branch information
jrybar-rh committed Apr 24, 2024
1 parent 3cc4847 commit fe7ee72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/polkitbackend/polkitbackendsessionmonitor-systemd.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ sd_source_new (void)
source = g_source_new (&sd_source_funcs, sizeof (SdSource));
sd_source = (SdSource *)source;

if ((ret = sd_login_monitor_new (NULL, &sd_source->monitor)) < 0)
if ((ret = sd_login_monitor_new ("session", &sd_source->monitor)) < 0)
{
g_printerr ("Error getting login monitor: %d", ret);
}
Expand Down

0 comments on commit fe7ee72

Please sign in to comment.