|
Ray Strode |
912b47 |
From 0b093b3cfbda8a2d75608b338d04c3bdc30b6b3a Mon Sep 17 00:00:00 2001
|
|
Ray Strode |
912b47 |
From: Ray Strode <rstrode@redhat.com>
|
|
Ray Strode |
912b47 |
Date: Mon, 25 Apr 2011 15:52:36 -0400
|
|
Ray Strode |
912b47 |
Subject: [PATCH 1/3] lib: always set is-loaded through maybe_set_is_loaded
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
maybe_set_is_loaded checks the various asynchronous things that
|
|
Ray Strode |
912b47 |
happen at startup and delays setting is-loaded until all those
|
|
Ray Strode |
912b47 |
initial start up tasks are finished.
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
We had one place in the code that was bypassing maybe_set_is_loaded
|
|
Ray Strode |
912b47 |
and settings is-loaded directly. This could mean the user manager
|
|
Ray Strode |
912b47 |
in some scenarios reports its loaded before it actually is.
|
|
Ray Strode |
912b47 |
---
|
|
Ray Strode |
912b47 |
src/libaccountsservice/act-user-manager.c | 2 +-
|
|
Ray Strode |
912b47 |
1 files changed, 1 insertions(+), 1 deletions(-)
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
912b47 |
index 7202b07..2af6808 100644
|
|
Ray Strode |
912b47 |
--- a/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
912b47 |
+++ b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
912b47 |
@@ -801,7 +801,7 @@ on_new_user_loaded (ActUser *user,
|
|
Ray Strode |
912b47 |
g_object_unref (user);
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
if (manager->priv->new_users == NULL) {
|
|
Ray Strode |
912b47 |
- set_is_loaded (manager, TRUE);
|
|
Ray Strode |
912b47 |
+ maybe_set_is_loaded (manager);
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
--
|
|
Ray Strode |
912b47 |
1.7.4.4
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
From 07f05cd823bb52bee449996a16b90eaa1b57f80f Mon Sep 17 00:00:00 2001
|
|
Ray Strode |
912b47 |
From: Ray Strode <rstrode@redhat.com>
|
|
Ray Strode |
912b47 |
Date: Mon, 25 Apr 2011 16:38:28 -0400
|
|
Ray Strode |
912b47 |
Subject: [PATCH 2/3] lib: add some additional debugging statements
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
The current debug logs leave a lot of guessing,
|
|
Ray Strode |
912b47 |
this commit tries to be a little more chatty.
|
|
Ray Strode |
912b47 |
---
|
|
Ray Strode |
912b47 |
src/libaccountsservice/act-user-manager.c | 46 ++++++++++++++++++++++++++--
|
|
Ray Strode |
912b47 |
1 files changed, 42 insertions(+), 4 deletions(-)
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
912b47 |
index 2af6808..3e463e6 100644
|
|
Ray Strode |
912b47 |
--- a/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
912b47 |
+++ b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
912b47 |
@@ -533,7 +533,8 @@ on_user_changed (ActUser *user,
|
|
Ray Strode |
912b47 |
ActUserManager *manager)
|
|
Ray Strode |
912b47 |
{
|
|
Ray Strode |
912b47 |
if (manager->priv->is_loaded) {
|
|
Ray Strode |
912b47 |
- g_debug ("ActUserManager: user changed");
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: user %s changed",
|
|
Ray Strode |
912b47 |
+ act_user_get_user_name (user));
|
|
Ray Strode |
912b47 |
g_signal_emit (manager, signals[USER_CHANGED], 0, user);
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
@@ -571,6 +572,8 @@ on_get_seat_id_finished (DBusGProxy *proxy,
|
|
Ray Strode |
912b47 |
"current session");
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
unload_seat (manager);
|
|
Ray Strode |
912b47 |
+
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: GetSeatId call failed, so trying to set loaded property");
|
|
Ray Strode |
912b47 |
maybe_set_is_loaded (manager);
|
|
Ray Strode |
912b47 |
return;
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
@@ -692,6 +695,7 @@ add_user (ActUserManager *manager,
|
|
Ray Strode |
912b47 |
{
|
|
Ray Strode |
912b47 |
const char *object_path;
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: tracking user '%s'", act_user_get_user_name (user));
|
|
Ray Strode |
912b47 |
g_hash_table_insert (manager->priv->users_by_name,
|
|
Ray Strode |
912b47 |
g_strdup (act_user_get_user_name (user)),
|
|
Ray Strode |
912b47 |
g_object_ref (user));
|
|
Ray Strode |
912b47 |
@@ -713,7 +717,10 @@ add_user (ActUserManager *manager,
|
|
Ray Strode |
912b47 |
manager);
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
if (manager->priv->is_loaded) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: loaded, so emitting user-added signal");
|
|
Ray Strode |
912b47 |
g_signal_emit (manager, signals[USER_ADDED], 0, user);
|
|
Ray Strode |
912b47 |
+ } else {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: not yet loaded, so not emitting user-added signal");
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
if (g_hash_table_size (manager->priv->users_by_name) > 1) {
|
|
Ray Strode |
912b47 |
@@ -725,6 +732,10 @@ static void
|
|
Ray Strode |
912b47 |
remove_user (ActUserManager *manager,
|
|
Ray Strode |
912b47 |
ActUser *user)
|
|
Ray Strode |
912b47 |
{
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: no longer tracking user '%s' (with object path %s)",
|
|
Ray Strode |
912b47 |
+ act_user_get_user_name (user),
|
|
Ray Strode |
912b47 |
+ act_user_get_object_path (user));
|
|
Ray Strode |
912b47 |
+
|
|
Ray Strode |
912b47 |
g_object_ref (user);
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
g_signal_handlers_disconnect_by_func (user, on_user_changed, manager);
|
|
Ray Strode |
912b47 |
@@ -738,7 +749,10 @@ remove_user (ActUserManager *manager,
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
if (manager->priv->is_loaded) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: loaded, so emitting user-removed signal");
|
|
Ray Strode |
912b47 |
g_signal_emit (manager, signals[USER_REMOVED], 0, user);
|
|
Ray Strode |
912b47 |
+ } else {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: not yet loaded, so not emitting user-removed signal");
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
g_object_unref (user);
|
|
Ray Strode |
912b47 |
@@ -759,7 +773,6 @@ on_new_user_loaded (ActUser *user,
|
|
Ray Strode |
912b47 |
if (!act_user_is_loaded (user)) {
|
|
Ray Strode |
912b47 |
return;
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
-
|
|
Ray Strode |
912b47 |
g_signal_handlers_disconnect_by_func (user, on_new_user_loaded, manager);
|
|
Ray Strode |
912b47 |
manager->priv->new_users = g_slist_remove (manager->priv->new_users,
|
|
Ray Strode |
912b47 |
user);
|
|
Ray Strode |
912b47 |
@@ -783,6 +796,8 @@ on_new_user_loaded (ActUser *user,
|
|
Ray Strode |
912b47 |
return;
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: user '%s' is now loaded", username);
|
|
Ray Strode |
912b47 |
+
|
|
Ray Strode |
912b47 |
if (username_in_exclude_list (manager, username)) {
|
|
Ray Strode |
912b47 |
g_debug ("ActUserManager: excluding user '%s'", username);
|
|
Ray Strode |
912b47 |
g_object_unref (user);
|
|
Ray Strode |
912b47 |
@@ -794,6 +809,8 @@ on_new_user_loaded (ActUser *user,
|
|
Ray Strode |
912b47 |
/* If username got added earlier by a different means, trump it now.
|
|
Ray Strode |
912b47 |
*/
|
|
Ray Strode |
912b47 |
if (old_user != NULL) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: user '%s' was already known, "
|
|
Ray Strode |
912b47 |
+ "replacing with freshly loaded object", username);
|
|
Ray Strode |
912b47 |
remove_user (manager, old_user);
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
@@ -801,6 +818,7 @@ on_new_user_loaded (ActUser *user,
|
|
Ray Strode |
912b47 |
g_object_unref (user);
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
if (manager->priv->new_users == NULL) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: no pending users, trying to set loaded property");
|
|
Ray Strode |
912b47 |
maybe_set_is_loaded (manager);
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
@@ -814,8 +832,13 @@ add_new_user_for_object_path (const char *object_path,
|
|
Ray Strode |
912b47 |
user = g_hash_table_lookup (manager->priv->users_by_object_path, object_path);
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
if (user != NULL) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: tracking existing user %s with object path %s",
|
|
Ray Strode |
912b47 |
+ act_user_get_user_name (user), object_path);
|
|
Ray Strode |
912b47 |
return user;
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
+
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: tracking new user with object path %s", object_path);
|
|
Ray Strode |
912b47 |
+
|
|
Ray Strode |
912b47 |
user = create_new_user (manager);
|
|
Ray Strode |
912b47 |
_act_user_update_from_object_path (user, object_path);
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
@@ -829,6 +852,7 @@ on_new_user_in_accounts_service (DBusGProxy *proxy,
|
|
Ray Strode |
912b47 |
{
|
|
Ray Strode |
912b47 |
ActUserManager *manager = ACT_USER_MANAGER (user_data);
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: new user in accounts service with object path %s", object_path);
|
|
Ray Strode |
912b47 |
add_new_user_for_object_path (object_path, manager);
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
@@ -840,6 +864,8 @@ on_user_removed_in_accounts_service (DBusGProxy *proxy,
|
|
Ray Strode |
912b47 |
ActUserManager *manager = ACT_USER_MANAGER (user_data);
|
|
Ray Strode |
912b47 |
ActUser *user;
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: user removed from accounts service with object path %s", object_path);
|
|
Ray Strode |
912b47 |
+
|
|
Ray Strode |
912b47 |
user = g_hash_table_lookup (manager->priv->users_by_object_path, object_path);
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
manager->priv->new_users = g_slist_remove (manager->priv->new_users, user);
|
|
Ray Strode |
912b47 |
@@ -879,6 +905,7 @@ on_get_current_session_finished (DBusGProxy *proxy,
|
|
Ray Strode |
912b47 |
g_debug ("Failed to identify the current session");
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
unload_seat (manager);
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: no current session, so trying to set loaded property");
|
|
Ray Strode |
912b47 |
maybe_set_is_loaded (manager);
|
|
Ray Strode |
912b47 |
return;
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
@@ -1155,6 +1182,7 @@ on_list_cached_users_finished (DBusGProxy *proxy,
|
|
Ray Strode |
912b47 |
return;
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: ListCachedUsers finished, so trying to set loaded property");
|
|
Ray Strode |
912b47 |
maybe_set_is_loaded (manager);
|
|
Ray Strode |
912b47 |
g_ptr_array_foreach (paths, (GFunc)add_new_user_for_object_path, manager);
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
@@ -1721,22 +1749,29 @@ static void
|
|
Ray Strode |
912b47 |
maybe_set_is_loaded (ActUserManager *manager)
|
|
Ray Strode |
912b47 |
{
|
|
Ray Strode |
912b47 |
if (manager->priv->is_loaded) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: already loaded, so not setting loaded property");
|
|
Ray Strode |
912b47 |
return;
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
if (manager->priv->get_sessions_call != NULL) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: GetSessions call pending, so not setting loaded property");
|
|
Ray Strode |
912b47 |
return;
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
if (manager->priv->listing_cached_users) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: Listing cached users, so not setting loaded property");
|
|
Ray Strode |
912b47 |
return;
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
/* Don't set is_loaded yet unless the seat is already loaded
|
|
Ray Strode |
912b47 |
* or failed to load.
|
|
Ray Strode |
912b47 |
*/
|
|
Ray Strode |
912b47 |
- if (manager->priv->seat.state != ACT_USER_MANAGER_SEAT_STATE_LOADED
|
|
Ray Strode |
912b47 |
- && manager->priv->seat.state != ACT_USER_MANAGER_SEAT_STATE_UNLOADED) {
|
|
Ray Strode |
912b47 |
+ if (manager->priv->seat.state == ACT_USER_MANAGER_SEAT_STATE_LOADED) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: Seat loaded, so now setting loaded property");
|
|
Ray Strode |
912b47 |
+ } else if (manager->priv->seat.state == ACT_USER_MANAGER_SEAT_STATE_UNLOADED) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: Seat wouldn't load, so giving up on it and setting loaded property");
|
|
Ray Strode |
912b47 |
+ } else {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: Seat still actively loading, so not setting loaded property");
|
|
Ray Strode |
912b47 |
return;
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
@@ -1811,6 +1846,8 @@ on_get_sessions_finished (DBusGProxy *proxy,
|
|
Ray Strode |
912b47 |
(int) sessions->len);
|
|
Ray Strode |
912b47 |
g_ptr_array_foreach (sessions, (GFunc) g_free, NULL);
|
|
Ray Strode |
912b47 |
g_ptr_array_free (sessions, TRUE);
|
|
Ray Strode |
912b47 |
+
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: GetSessions call finished, so trying to set loaded property");
|
|
Ray Strode |
912b47 |
maybe_set_is_loaded (manager);
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
@@ -1880,6 +1917,7 @@ load_seat_incrementally (ActUserManager *manager)
|
|
Ray Strode |
912b47 |
load_sessions (manager);
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: Seat loading sequence complete, so trying to set loaded property");
|
|
Ray Strode |
912b47 |
maybe_set_is_loaded (manager);
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
--
|
|
Ray Strode |
912b47 |
1.7.4.4
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
From f938e70e4c71b63235702a48ab6d2400488c3ea6 Mon Sep 17 00:00:00 2001
|
|
Ray Strode |
912b47 |
From: Ray Strode <rstrode@redhat.com>
|
|
Ray Strode |
912b47 |
Date: Mon, 25 Apr 2011 16:58:58 -0400
|
|
Ray Strode |
912b47 |
Subject: [PATCH 3/3] lib: ignore new users before ListCachedUsers finishes
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
We're going to be loading any users that come in shortly afterward
|
|
Ray Strode |
912b47 |
anyway, so don't bother handling it yet.
|
|
Ray Strode |
912b47 |
---
|
|
Ray Strode |
912b47 |
src/libaccountsservice/act-user-manager.c | 5 +++++
|
|
Ray Strode |
912b47 |
1 files changed, 5 insertions(+), 0 deletions(-)
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
912b47 |
index 3e463e6..07c8e34 100644
|
|
Ray Strode |
912b47 |
--- a/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
912b47 |
+++ b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
912b47 |
@@ -852,6 +852,11 @@ on_new_user_in_accounts_service (DBusGProxy *proxy,
|
|
Ray Strode |
912b47 |
{
|
|
Ray Strode |
912b47 |
ActUserManager *manager = ACT_USER_MANAGER (user_data);
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
912b47 |
+ if (!manager->priv->is_loaded) {
|
|
Ray Strode |
912b47 |
+ g_debug ("ActUserManager: ignoring new user in accounts service with object path %s since not loaded yet", object_path);
|
|
Ray Strode |
912b47 |
+ return;
|
|
Ray Strode |
912b47 |
+ }
|
|
Ray Strode |
912b47 |
+
|
|
Ray Strode |
912b47 |
g_debug ("ActUserManager: new user in accounts service with object path %s", object_path);
|
|
Ray Strode |
912b47 |
add_new_user_for_object_path (object_path, manager);
|
|
Ray Strode |
912b47 |
}
|
|
Ray Strode |
912b47 |
--
|
|
Ray Strode |
912b47 |
1.7.4.4
|
|
Ray Strode |
912b47 |
|
|
Ray Strode |
7897fc |
From ce35916e540ead4a84a779841b9b3f81b7595a34 Mon Sep 17 00:00:00 2001
|
|
Ray Strode |
b1325a |
From: Ray Strode <rstrode@redhat.com>
|
|
Ray Strode |
b1325a |
Date: Tue, 26 Apr 2011 10:24:04 -0400
|
|
Ray Strode |
b1325a |
Subject: [PATCH] lib: set is-loaded only after we've actually loaded the
|
|
Ray Strode |
b1325a |
users
|
|
Ray Strode |
b1325a |
|
|
Ray Strode |
b1325a |
Before we were setting it as soon as we got the unloaded list,
|
|
Ray Strode |
b1325a |
which isn't sufficient, since callers wait for is-loaded to call
|
|
Ray Strode |
b1325a |
list_users, and list_users only returns loaded users.
|
|
Ray Strode |
b1325a |
|
|
Ray Strode |
b1325a |
(bug initially introduced by commit fffd5c51a54682e17ac61e374d629e9aa0dbeeb1)
|
|
Ray Strode |
b1325a |
---
|
|
Ray Strode |
7897fc |
src/libaccountsservice/act-user-manager.c | 18 ++++++++++++++----
|
|
Ray Strode |
7897fc |
1 files changed, 14 insertions(+), 4 deletions(-)
|
|
Ray Strode |
b1325a |
|
|
Ray Strode |
b1325a |
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
7897fc |
index 07c8e34..e98140e 100644
|
|
Ray Strode |
b1325a |
--- a/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
b1325a |
+++ b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
b1325a |
@@ -793,7 +793,7 @@ on_new_user_loaded (ActUser *user,
|
|
Ray Strode |
b1325a |
(int) act_user_get_uid (user));
|
|
Ray Strode |
b1325a |
}
|
|
Ray Strode |
b1325a |
g_object_unref (user);
|
|
Ray Strode |
b1325a |
- return;
|
|
Ray Strode |
b1325a |
+ goto out;
|
|
Ray Strode |
b1325a |
}
|
|
Ray Strode |
b1325a |
|
|
Ray Strode |
b1325a |
g_debug ("ActUserManager: user '%s' is now loaded", username);
|
|
Ray Strode |
b1325a |
@@ -801,7 +801,7 @@ on_new_user_loaded (ActUser *user,
|
|
Ray Strode |
b1325a |
if (username_in_exclude_list (manager, username)) {
|
|
Ray Strode |
b1325a |
g_debug ("ActUserManager: excluding user '%s'", username);
|
|
Ray Strode |
b1325a |
g_object_unref (user);
|
|
Ray Strode |
b1325a |
- return;
|
|
Ray Strode |
b1325a |
+ goto out;
|
|
Ray Strode |
b1325a |
}
|
|
Ray Strode |
b1325a |
|
|
Ray Strode |
b1325a |
old_user = g_hash_table_lookup (manager->priv->users_by_name, username);
|
|
Ray Strode |
b1325a |
@@ -817,6 +817,7 @@ on_new_user_loaded (ActUser *user,
|
|
Ray Strode |
b1325a |
add_user (manager, user);
|
|
Ray Strode |
b1325a |
g_object_unref (user);
|
|
Ray Strode |
b1325a |
|
|
Ray Strode |
b1325a |
+out:
|
|
Ray Strode |
b1325a |
if (manager->priv->new_users == NULL) {
|
|
Ray Strode |
b1325a |
g_debug ("ActUserManager: no pending users, trying to set loaded property");
|
|
Ray Strode |
b1325a |
maybe_set_is_loaded (manager);
|
|
Ray Strode |
b1325a |
@@ -1187,8 +1188,12 @@ on_list_cached_users_finished (DBusGProxy *proxy,
|
|
Ray Strode |
b1325a |
return;
|
|
Ray Strode |
b1325a |
}
|
|
Ray Strode |
b1325a |
|
|
Ray Strode |
b1325a |
- g_debug ("ActUserManager: ListCachedUsers finished, so trying to set loaded property");
|
|
Ray Strode |
b1325a |
- maybe_set_is_loaded (manager);
|
|
Ray Strode |
b1325a |
+ /* We now have a batch of unloaded users that we know about. Once that initial
|
|
Ray Strode |
b1325a |
+ * batch is loaded up, we can mark the manager as loaded.
|
|
Ray Strode |
b1325a |
+ *
|
|
Ray Strode |
b1325a |
+ * (see on_new_user_loaded)
|
|
Ray Strode |
b1325a |
+ */
|
|
Ray Strode |
b1325a |
+ g_debug ("ActUserManager: ListCachedUsers finished, will set loaded property after list is fully loaded");
|
|
Ray Strode |
b1325a |
g_ptr_array_foreach (paths, (GFunc)add_new_user_for_object_path, manager);
|
|
Ray Strode |
b1325a |
|
|
Ray Strode |
b1325a |
g_ptr_array_foreach (paths, (GFunc)g_free, NULL);
|
|
Ray Strode |
7897fc |
@@ -1768,6 +1773,11 @@ maybe_set_is_loaded (ActUserManager *manager)
|
|
Ray Strode |
7897fc |
return;
|
|
Ray Strode |
7897fc |
}
|
|
Ray Strode |
7897fc |
|
|
Ray Strode |
7897fc |
+ if (manager->priv->new_users != NULL) {
|
|
Ray Strode |
7897fc |
+ g_debug ("ActUserManager: Loading new users, so not setting loaded property");
|
|
Ray Strode |
7897fc |
+ return;
|
|
Ray Strode |
7897fc |
+ }
|
|
Ray Strode |
7897fc |
+
|
|
Ray Strode |
7897fc |
/* Don't set is_loaded yet unless the seat is already loaded
|
|
Ray Strode |
7897fc |
* or failed to load.
|
|
Ray Strode |
7897fc |
*/
|
|
Ray Strode |
b1325a |
--
|
|
Ray Strode |
b1325a |
1.7.4.4
|
|
Ray Strode |
b1325a |
|
|
Ray Strode |
71a418 |
From c94351c10838daeafedf0c37cea41c7308799802 Mon Sep 17 00:00:00 2001
|
|
Ray Strode |
71a418 |
From: Ray Strode <rstrode@redhat.com>
|
|
Ray Strode |
71a418 |
Date: Wed, 27 Apr 2011 14:36:50 -0400
|
|
Ray Strode |
71a418 |
Subject: [PATCH] lib: don't block loading for get_user() requests
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
When an app does a get_user() request the user gets added to the
|
|
Ray Strode |
71a418 |
"new user" list while its loading up.
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
We currently delaying loading until the "new user" list is empty,
|
|
Ray Strode |
71a418 |
but get_user() requests are deferred until initial loading is done,
|
|
Ray Strode |
71a418 |
so if a get_user() request comes in during initial load, load will
|
|
Ray Strode |
71a418 |
never complete.
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
This commit differentiates new users resulting from the initial
|
|
Ray Strode |
71a418 |
ListCachedUsers call and new users resulting from get_user() requests.
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
Only the first group inhibit the initial load from completing.
|
|
Ray Strode |
71a418 |
---
|
|
Ray Strode |
71a418 |
src/libaccountsservice/act-user-manager.c | 33 ++++++++++++++++++++++++++--
|
|
Ray Strode |
71a418 |
1 files changed, 30 insertions(+), 3 deletions(-)
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
71a418 |
index e98140e..379c972 100644
|
|
Ray Strode |
71a418 |
--- a/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
71a418 |
+++ b/src/libaccountsservice/act-user-manager.c
|
|
Ray Strode |
71a418 |
@@ -140,6 +140,7 @@ struct ActUserManagerPrivate
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
GSList *new_sessions;
|
|
Ray Strode |
71a418 |
GSList *new_users;
|
|
Ray Strode |
71a418 |
+ GSList *new_users_inhibiting_load;
|
|
Ray Strode |
71a418 |
GSList *fetch_user_requests;
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
GSList *exclude_usernames;
|
|
Ray Strode |
71a418 |
@@ -771,11 +772,16 @@ on_new_user_loaded (ActUser *user,
|
|
Ray Strode |
71a418 |
ActUser *old_user;
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
if (!act_user_is_loaded (user)) {
|
|
Ray Strode |
71a418 |
+ g_debug ("ActUserManager: user '%s' loaded function called when not loaded",
|
|
Ray Strode |
71a418 |
+ act_user_get_user_name (user));
|
|
Ray Strode |
71a418 |
return;
|
|
Ray Strode |
71a418 |
}
|
|
Ray Strode |
71a418 |
g_signal_handlers_disconnect_by_func (user, on_new_user_loaded, manager);
|
|
Ray Strode |
71a418 |
+
|
|
Ray Strode |
71a418 |
manager->priv->new_users = g_slist_remove (manager->priv->new_users,
|
|
Ray Strode |
71a418 |
user);
|
|
Ray Strode |
71a418 |
+ manager->priv->new_users_inhibiting_load = g_slist_remove (manager->priv->new_users_inhibiting_load,
|
|
Ray Strode |
71a418 |
+ user);
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
username = act_user_get_user_name (user);
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
@@ -818,9 +824,11 @@ on_new_user_loaded (ActUser *user,
|
|
Ray Strode |
71a418 |
g_object_unref (user);
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
out:
|
|
Ray Strode |
71a418 |
- if (manager->priv->new_users == NULL) {
|
|
Ray Strode |
71a418 |
+ if (manager->priv->new_users_inhibiting_load == NULL) {
|
|
Ray Strode |
71a418 |
g_debug ("ActUserManager: no pending users, trying to set loaded property");
|
|
Ray Strode |
71a418 |
maybe_set_is_loaded (manager);
|
|
Ray Strode |
71a418 |
+ } else {
|
|
Ray Strode |
71a418 |
+ g_debug ("ActUserManager: not all users loaded yet");
|
|
Ray Strode |
71a418 |
}
|
|
Ray Strode |
71a418 |
}
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
@@ -1165,6 +1173,19 @@ set_is_loaded (ActUserManager *manager,
|
|
Ray Strode |
71a418 |
}
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
static void
|
|
Ray Strode |
71a418 |
+add_new_inhibiting_user_for_object_path (const char *object_path,
|
|
Ray Strode |
71a418 |
+ ActUserManager *manager)
|
|
Ray Strode |
71a418 |
+{
|
|
Ray Strode |
71a418 |
+ ActUser *user;
|
|
Ray Strode |
71a418 |
+
|
|
Ray Strode |
71a418 |
+ user = add_new_user_for_object_path (object_path, manager);
|
|
Ray Strode |
71a418 |
+
|
|
Ray Strode |
71a418 |
+ if (!manager->priv->is_loaded) {
|
|
Ray Strode |
71a418 |
+ manager->priv->new_users_inhibiting_load = g_slist_prepend (manager->priv->new_users_inhibiting_load, user);
|
|
Ray Strode |
71a418 |
+ }
|
|
Ray Strode |
71a418 |
+}
|
|
Ray Strode |
71a418 |
+
|
|
Ray Strode |
71a418 |
+static void
|
|
Ray Strode |
71a418 |
on_list_cached_users_finished (DBusGProxy *proxy,
|
|
Ray Strode |
71a418 |
DBusGProxyCall *call_id,
|
|
Ray Strode |
71a418 |
gpointer data)
|
|
Ray Strode |
71a418 |
@@ -1194,7 +1215,7 @@ on_list_cached_users_finished (DBusGProxy *proxy,
|
|
Ray Strode |
71a418 |
* (see on_new_user_loaded)
|
|
Ray Strode |
71a418 |
*/
|
|
Ray Strode |
71a418 |
g_debug ("ActUserManager: ListCachedUsers finished, will set loaded property after list is fully loaded");
|
|
Ray Strode |
71a418 |
- g_ptr_array_foreach (paths, (GFunc)add_new_user_for_object_path, manager);
|
|
Ray Strode |
71a418 |
+ g_ptr_array_foreach (paths, (GFunc)add_new_inhibiting_user_for_object_path, manager);
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
g_ptr_array_foreach (paths, (GFunc)g_free, NULL);
|
|
Ray Strode |
71a418 |
g_ptr_array_free (paths, TRUE);
|
|
Ray Strode |
71a418 |
@@ -1616,6 +1637,9 @@ on_user_manager_maybe_ready_for_request (ActUserManager *manager
|
|
Ray Strode |
71a418 |
return;
|
|
Ray Strode |
71a418 |
}
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
+ g_debug ("ActUserManager: user manager now loaded, proceeding with fetch user request for user '%s'",
|
|
Ray Strode |
71a418 |
+ request->username);
|
|
Ray Strode |
71a418 |
+
|
|
Ray Strode |
71a418 |
g_signal_handlers_disconnect_by_func (manager, on_user_manager_maybe_ready_for_request, request);
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
request->state++;
|
|
Ray Strode |
71a418 |
@@ -1714,6 +1738,7 @@ act_user_manager_get_user (ActUserManager *manager,
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
/* if we don't have it loaded try to load it now */
|
|
Ray Strode |
71a418 |
if (user == NULL) {
|
|
Ray Strode |
71a418 |
+ g_debug ("ActUserManager: trying to track new user with username %s", username);
|
|
Ray Strode |
71a418 |
user = create_new_user (manager);
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
if (manager->priv->accounts_proxy != NULL) {
|
|
Ray Strode |
71a418 |
@@ -1773,7 +1798,7 @@ maybe_set_is_loaded (ActUserManager *manager)
|
|
Ray Strode |
71a418 |
return;
|
|
Ray Strode |
71a418 |
}
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
- if (manager->priv->new_users != NULL) {
|
|
Ray Strode |
71a418 |
+ if (manager->priv->new_users_inhibiting_load != NULL) {
|
|
Ray Strode |
71a418 |
g_debug ("ActUserManager: Loading new users, so not setting loaded property");
|
|
Ray Strode |
71a418 |
return;
|
|
Ray Strode |
71a418 |
}
|
|
Ray Strode |
71a418 |
@@ -2186,6 +2211,8 @@ act_user_manager_finalize (GObject *object)
|
|
Ray Strode |
71a418 |
(GFunc) free_fetch_user_request, NULL);
|
|
Ray Strode |
71a418 |
g_slist_free (manager->priv->fetch_user_requests);
|
|
Ray Strode |
71a418 |
|
|
Ray Strode |
71a418 |
+ g_slist_free (manager->priv->new_users_inhibiting_load);
|
|
Ray Strode |
71a418 |
+
|
|
Ray Strode |
71a418 |
node = manager->priv->new_users;
|
|
Ray Strode |
71a418 |
while (node != NULL) {
|
|
Ray Strode |
71a418 |
ActUser *user;
|
|
Ray Strode |
71a418 |
--
|
|
Ray Strode |
71a418 |
1.7.4.4
|
|
Ray Strode |
71a418 |
|