Blob Blame Raw
From 9b03e52b2504f215f960549c53bd4f617797dedd Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 3 Oct 2017 10:04:28 -0400
Subject: [PATCH 10/13] lib: retry connecting to accountsservice when loading
 users

If we were unable to connect to accountsservice and we need to
load users again, then try again.
---
 src/libaccountsservice/act-user-manager.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c
index 5ac157d..c8a0e20 100644
--- a/src/libaccountsservice/act-user-manager.c
+++ b/src/libaccountsservice/act-user-manager.c
@@ -2544,60 +2544,64 @@ load_console_kit_sessions (ActUserManager *manager)
                 g_debug ("ActUserManager: no seat proxy; can't load sessions");
                 return;
         }
 
         manager->priv->getting_sessions = TRUE;
         console_kit_seat_call_get_sessions (manager->priv->seat.seat_proxy,
                                             NULL,
                                             on_get_sessions_finished,
                                             g_object_ref (manager));
 }
 
 static void
 load_sessions (ActUserManager *manager)
 {
 #ifdef WITH_SYSTEMD
         if (LOGIND_RUNNING()) {
                 reload_systemd_sessions (manager);
                 maybe_set_is_loaded (manager);
                 return;
         }
 #endif
         load_console_kit_sessions (manager);
 }
 
 static void
 load_users (ActUserManager *manager)
 {
         g_assert (manager->priv->accounts_proxy != NULL);
         g_debug ("ActUserManager: calling 'ListCachedUsers'");
 
+        if (!ensure_accounts_proxy (manager)) {
+                return;
+        }
+
         accounts_accounts_call_list_cached_users (manager->priv->accounts_proxy,
                                                   NULL,
                                                   on_list_cached_users_finished,
                                                   g_object_ref (manager));
         manager->priv->listing_cached_users = TRUE;
 }
 
 static gboolean
 load_seat_incrementally (ActUserManager *manager)
 {
         manager->priv->seat.load_idle_id = 0;
 
         switch (manager->priv->seat.state) {
         case ACT_USER_MANAGER_SEAT_STATE_GET_SESSION_ID:
                 get_current_session_id (manager);
                 break;
         case ACT_USER_MANAGER_SEAT_STATE_GET_SESSION_PROXY:
                 get_session_proxy (manager);
                 break;
         case ACT_USER_MANAGER_SEAT_STATE_GET_ID:
                 get_seat_id_for_current_session (manager);
                 break;
         case ACT_USER_MANAGER_SEAT_STATE_GET_SEAT_PROXY:
                 get_seat_proxy (manager);
                 break;
         case ACT_USER_MANAGER_SEAT_STATE_LOADED:
                 g_debug ("ActUserManager: Seat loading sequence complete");
                 break;
         default:
                 g_assert_not_reached ();
-- 
2.14.1