[gnome-keyring] daemon: Wait a moment after replacing another daemon



commit e490b881a2326b1fe4f0a6339a4df030da8c9038
Author: Stef Walter <stefw collabora co uk>
Date:   Wed Aug 31 09:29:29 2011 +0200

    daemon: Wait a moment after replacing another daemon
    
     * This allows the other daemon to close before we try to open the
       same sockets and stuff.

 daemon/gkd-main.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gkd-main.c b/daemon/gkd-main.c
index f5cc5d6..b60507d 100644
--- a/daemon/gkd-main.c
+++ b/daemon/gkd-main.c
@@ -521,9 +521,20 @@ initialize_daemon_at (const gchar *directory)
 static gboolean
 replace_daemon_at (const gchar *directory)
 {
+	gboolean ret;
+
 	g_free (control_directory);
 	control_directory = g_strdup (directory);
-	return gkd_control_quit (directory);
+	ret = gkd_control_quit (directory);
+
+	/*
+	 * If we quit, wait a short time before initializing so the other
+	 * daemon can quit completely
+	 */
+	if (ret == TRUE)
+		g_usleep (200 * 1000); /* 200 ms in us */
+
+	return ret;
 }
 
 typedef gboolean (*DiscoverFunc) (const gchar *control_directory);



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