[gvfs] afc: Tweak HouseArrest warning output



commit 36f3ab7147c31e5dc067aebedb5c38dc163ffbd3
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jun 9 12:43:44 2016 +0200

    afc: Tweak HouseArrest warning output
    
    Only throw a warning when the second attempt at setting up HouseArrest
    fails, not when we're going to retry. This makes it easier to see real
    warnings compared to normal run-time behaviour.

 daemon/gvfsbackendafc.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index 7d51ce4..f1b1758 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -811,6 +811,7 @@ is_regular (GVfsBackendAfc *backend,
 
 static gboolean
 g_vfs_backend_setup_afc_for_app (GVfsBackendAfc *self,
+                                 gboolean        last_try,
                                  const char     *id)
 {
   AppInfo *info;
@@ -841,10 +842,14 @@ g_vfs_backend_setup_afc_for_app (GVfsBackendAfc *self,
   lerr = lockdownd_start_service (lockdown_cli, "com.apple.mobile.house_arrest", &lockdown_service);
   if (lerr != LOCKDOWN_E_SUCCESS)
     {
-      if (lerr == LOCKDOWN_E_SERVICE_LIMIT)
-        retry = TRUE;
+      if (lerr == LOCKDOWN_E_SERVICE_LIMIT && !last_try)
+        {
+          retry = TRUE;
+          g_debug ("Failed to start house arrest for app %s (%d)\n", info->id, lerr);
+        }
+      else
+        g_warning ("Failed to start house arrest for app %s (%d)", info->id, lerr);
       lockdownd_client_free (lockdown_cli);
-      g_warning ("Failed to start house arrest for app %s (%d)", info->id, lerr);
       goto out;
     }
 
@@ -1040,11 +1045,11 @@ g_vfs_backend_parse_house_arrest_path (GVfsBackendAfc *self,
   if (app != NULL &&
       setup_afc)
     {
-      if (!g_vfs_backend_setup_afc_for_app (self, app))
+      if (!g_vfs_backend_setup_afc_for_app (self, FALSE, app))
         {
           g_debug ("Ran out of HouseArrest clients for app '%s', trying again\n", app);
           g_vfs_backend_gc_house_arrest (self, app);
-          g_vfs_backend_setup_afc_for_app (self, app);
+          g_vfs_backend_setup_afc_for_app (self, TRUE, app);
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]