Re: GConf in Debian Sarge



Le jeu, 24/06/2004 à 23:48 -0400, Havoc Pennington a écrit :
> On Tue, 2004-06-22 at 04:49, Josselin Mouette wrote:
> > 
> > Oh, I see. But maybe it's a bit overkill: wouldn't it be simpler to just
> > use the periodic cleanup function which is already run every 30s?
> > Compared with the time an upgrade generally takes, waiting for at most
> > 30s for the new schemas to be available would be enough.
> 
> That sounds fine to me.

OK, do you think the attached implementation is correct?
-- 
 .''`.           Josselin Mouette        /\./\
: :' :           josselin mouette ens-lyon org
`. `'                        joss debian org
  `-  Debian GNU/Linux -- The power of freedom
--- GConf-2.6.1/gconf/gconfd.c.old	2004-06-21 16:16:50.000000000 +0200
+++ GConf-2.6.1/gconf/gconfd.c	2004-06-21 16:26:45.000000000 +0200
@@ -120,6 +120,13 @@
 
 static gboolean in_shutdown = FALSE;
 
+/*
+ * This flags indicates we received a signal asking for the reload of
+ * all databases.
+ */
+
+static gboolean need_db_reload = FALSE;
+
 /* 
  * CORBA goo
  */
@@ -397,7 +404,6 @@
     break;
 
   case SIGTERM:
-  case SIGHUP:
     enter_shutdown ();
 
     /* let the fatal signals interrupt us */
@@ -410,6 +416,13 @@
       gconf_main_quit ();
     break;
 
+  case SIGHUP:
+    --in_fatal;
+
+    /* reload databases on next main loop */
+    need_db_reload = TRUE;
+    break;
+
   case SIGUSR1:
     --in_fatal;
     
@@ -746,7 +759,17 @@
 
 static gboolean
 periodic_cleanup_timeout(gpointer data)
-{  
+{ 
+  if (need_db_reload)
+    {
+      need_db_reload = FALSE;
+      gconf_log (GCL_INFO, _("Reloading all databases"));
+      /* Regenerate the databases from the default sources */
+      shutdown_databases ();
+      init_databases ();
+      gconf_server_load_sources ();		  
+    }
+  
   gconf_log (GCL_DEBUG, "Performing periodic cleanup, expiring cache cruft");
   
   drop_old_clients ();

Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=



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