diff options
author | William Jon McCann <jmccann@redhat.com> | 2010-06-07 20:10:35 -0400 |
---|---|---|
committer | William Jon McCann <jmccann@redhat.com> | 2010-06-08 14:54:42 -0400 |
commit | 1289b3db3ddb5ec33a1914ab2e96b3bb43d8946a (patch) | |
tree | b535a9a088c37324ee31989f6dae23ea1c5b56b4 /gui/simple-greeter | |
parent | d131b965cb652ba1e37a7adaa8399080b09727ed (diff) | |
download | gdm-1289b3db3ddb5ec33a1914ab2e96b3bb43d8946a.tar.gz |
Throttle reloading passwd file to at most every 5 seconds
https://bugzilla.gnome.org/show_bug.cgi?id=620908
Diffstat (limited to 'gui/simple-greeter')
-rw-r--r-- | gui/simple-greeter/gdm-user-manager.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/gui/simple-greeter/gdm-user-manager.c b/gui/simple-greeter/gdm-user-manager.c index be2888d3..d71fb727 100644 --- a/gui/simple-greeter/gdm-user-manager.c +++ b/gui/simple-greeter/gdm-user-manager.c @@ -96,6 +96,7 @@ struct GdmUserManagerPrivate gboolean include_all; guint load_id; + guint reload_passwd_id; guint ck_history_id; guint8 users_dirty : 1; @@ -1556,6 +1557,25 @@ queue_load_users (GdmUserManager *manager) manager->priv->load_id = g_idle_add ((GSourceFunc)load_users_idle, manager); } +static gboolean +reload_passwd_idle (GdmUserManager *manager) +{ + reload_passwd (manager); + manager->priv->reload_passwd_id = 0; + + return FALSE; +} + +static void +queue_reload_passwd (GdmUserManager *manager) +{ + if (manager->priv->reload_passwd_id > 0) { + g_source_remove (manager->priv->reload_passwd_id); + } + + manager->priv->reload_passwd_id = g_timeout_add_seconds (5, (GSourceFunc)reload_passwd_idle, manager); +} + static void reload_shells (GdmUserManager *manager) { @@ -1593,7 +1613,7 @@ on_shells_monitor_changed (GFileMonitor *monitor, } reload_shells (manager); - reload_passwd (manager); + queue_reload_passwd (manager); } static void @@ -1608,7 +1628,7 @@ on_passwd_monitor_changed (GFileMonitor *monitor, return; } - reload_passwd (manager); + queue_reload_passwd (manager); } static void @@ -1814,6 +1834,11 @@ gdm_user_manager_finalize (GObject *object) manager->priv->load_id = 0; } + if (manager->priv->reload_passwd_id > 0) { + g_source_remove (manager->priv->reload_passwd_id); + manager->priv->reload_passwd_id = 0; + } + g_hash_table_destroy (manager->priv->sessions); g_file_monitor_cancel (manager->priv->passwd_monitor); |