Author: kelnos
Date: 2008-10-17 08:02:28 +0000 (Fri, 17 Oct 2008)
New Revision: 28273
Modified:
xfce4-session/trunk/ChangeLog
xfce4-session/trunk/NEWS
xfce4-session/trunk/xfce4-session/xfsm-manager.c
xfce4-session/trunk/xfce4-session/xfsm-manager.h
xfce4-session/trunk/xfce4-session/xfsm-properties.c
xfce4-session/trunk/xfce4-session/xfsm-properties.h
xfce4-session/trunk/xfce4-session/xfsm-startup.c
xfce4-session/trunk/xfce4-session/xfsm-startup.h
Log:
* xfce4-session/xfsm-properties.[ch]: Track the PID of properties
that have an associated app running, whether or not it's
registered with the SM. Add client ID comparison function.
Track the child watch GSource and provide a way to reset the
child watch to a function that simply reaps the child.
* xfce4-session/xfsm-startup.[ch]: Move handling of the child
watch and startup timeout, and make the properties starter
global so the manager can make use of it. Merge a couple
data structures, and record a launched client's PID in its
properties structure.
* xfce4-session/xfsm-manager.[ch]: Implement SmRestartImmediately
support. Remove some code duplication. Add an accessor
func for the manager's state. Add a timeout function that
resets the 'restart attempts' counter if the client has been
alive for a while (5 minutes).
Modified: xfce4-session/trunk/ChangeLog
===================================================================
--- xfce4-session/trunk/ChangeLog 2008-10-17 07:59:17 UTC (rev 28272)
+++ xfce4-session/trunk/ChangeLog 2008-10-17 08:02:28 UTC (rev 28273)
@@ -1,3 +1,21 @@
+2008-10-17 Brian Tarricone <[EMAIL PROTECTED]>
+
+ * xfce4-session/xfsm-properties.[ch]: Track the PID of properties
+ that have an associated app running, whether or not it's
+ registered with the SM. Add client ID comparison function.
+ Track the child watch GSource and provide a way to reset the
+ child watch to a function that simply reaps the child.
+ * xfce4-session/xfsm-startup.[ch]: Move handling of the child
+ watch and startup timeout, and make the properties starter
+ global so the manager can make use of it. Merge a couple
+ data structures, and record a launched client's PID in its
+ properties structure.
+ * xfce4-session/xfsm-manager.[ch]: Implement SmRestartImmediately
+ support. Remove some code duplication. Add an accessor
+ func for the manager's state. Add a timeout function that
+ resets the 'restart attempts' counter if the client has been
+ alive for a while (5 minutes).
+
2008-10-15 Brian Tarricone <[EMAIL PROTECTED]>
* xfce4-session/xfsm-client.c: Grab the GList pointer to iterate
Modified: xfce4-session/trunk/NEWS
===================================================================
--- xfce4-session/trunk/NEWS 2008-10-17 07:59:17 UTC (rev 28272)
+++ xfce4-session/trunk/NEWS 2008-10-17 08:02:28 UTC (rev 28273)
@@ -1,3 +1,8 @@
+4.5.92
+======
+- Implement support for the RestartImmediately restart style hint.
+
+
4.5.91
======
- Start up session in parallel to greatly shorten startup time (bug 4312).
@@ -10,6 +15,9 @@
quit as before (bug 4313).
- Check for a running gnome-keyring instance before launching
a new one (bug 3007).
+- Convert most of xfce4-session to use Xfconf. Splash settings are still
+ stored in the xfce4-splash.rc file. The xfce4-session.rc file is no longer
+ used, however.
4.5.90
Modified: xfce4-session/trunk/xfce4-session/xfsm-manager.c
===================================================================
--- xfce4-session/trunk/xfce4-session/xfsm-manager.c 2008-10-17 07:59:17 UTC
(rev 28272)
+++ xfce4-session/trunk/xfce4-session/xfsm-manager.c 2008-10-17 08:02:28 UTC
(rev 28273)
@@ -339,17 +339,80 @@
}
-void
-xfsm_manager_handle_failed_client (XfsmManager *manager,
- XfsmProperties *properties)
+gboolean
+xfsm_manager_handle_failed_properties (XfsmManager *manager,
+ XfsmProperties *properties)
{
- /* Handle apps that failed to start here */
+ /* Handle apps that failed to start, or died randomly, here */
- if (properties->discard_command != NULL)
+ xfsm_properties_set_default_child_watch (properties);
+
+ if (properties->restart_attempts_reset_id > 0)
{
- xfsm_verbose ("Client Id = %s failed to start, running discard "
- "command now.\n\n", properties->client_id);
+ g_source_remove (properties->restart_attempts_reset_id);
+ properties->restart_attempts_reset_id = 0;
+ }
+ if (properties->restart_style_hint == SmRestartAnyway)
+ {
+ g_queue_push_tail (manager->restart_properties, properties);
+ }
+ else if (properties->restart_style_hint == SmRestartImmediately)
+ {
+ if (++properties->restart_attempts > MAX_RESTART_ATTEMPTS)
+ {
+ xfsm_verbose ("Client Id = %s, reached maximum attempts [Restart
attempts = %d]\n"
+ " Will be re-scheduled for run on next startup\n",
+ properties->client_id, properties->restart_attempts);
+
+ g_queue_push_tail (manager->restart_properties, properties);
+ }
+ else
+ {
+ xfsm_verbose ("Client Id = %s disconnected, restarting\n",
+ properties->client_id);
+
+ if (G_UNLIKELY (!xfsm_startup_start_properties (properties,
manager)))
+ {
+ xfsm_verbose ("Client Id = %s failed to restart; removing from
client "
+ "list and running discard command\n",
+ properties->client_id);
+
+ /* FIXME: should we just re-add it to the list of restart
+ * properties and hope we're able to start it next session? */
+ if (properties->discard_command != NULL)
+ {
+ g_spawn_sync (properties->current_directory,
+ properties->discard_command,
+ properties->environment,
+ G_SPAWN_SEARCH_PATH,
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ }
+
+ return FALSE;
+ }
+ else
+ {
+ /* put it back in the starting list */
+ g_queue_push_tail (manager->starting_properties, properties);
+ }
+ }
+ }
+ else if (manager->state == XFSM_MANAGER_IDLE && properties->discard_command
!= NULL)
+ {
+ /* Run the SmDiscardCommand after the client exited in IDLE state,
+ * but only if we don't expect the client to be restarted,
+ * whether immediately or in the next session.
+ * Unfortunately the spec isn't clear about the usage of the
+ * discard command. Have to check ksmserver/gnome-session, and
+ * come up with consistent behaviour.
+ * But for now, this work-around fixes the problem of the
+ * ever-growing number of xfwm4 session files when restarting
+ * xfwm4 within a session.
+ */
+ xfsm_verbose ("Client Id = %s exited while in IDLE state, running "
+ "discard command now.\n\n", properties->client_id);
+
g_spawn_sync (properties->current_directory,
properties->discard_command,
properties->environment,
@@ -357,10 +420,11 @@
NULL, NULL,
NULL, NULL,
NULL, NULL);
+
+ return FALSE;
}
- if (g_queue_peek_head (manager->starting_properties) == NULL)
- xfsm_startup_session_continue (manager);
+ return TRUE;
}
@@ -735,16 +799,15 @@
}
-static gint
-xfsm_properties_queue_find (gconstpointer a,
- gconstpointer b)
+static gboolean
+xfsm_manager_reset_restart_attempts (gpointer data)
{
- XfsmProperties *properties = XFSM_PROPERTIES (a);
- const gchar *previous_id = (const gchar *) b;
+ XfsmProperties *properties = data;
- if (strcmp (properties->client_id, previous_id) == 0)
- return 0;
- return 1;
+ properties->restart_attempts = 0;
+ properties->restart_attempts_reset_id = 0;
+
+ return FALSE;
}
@@ -764,7 +827,7 @@
{
lp = g_queue_find_custom (manager->starting_properties,
previous_id,
- xfsm_properties_queue_find);
+ (GCompareFunc) xfsm_properties_compare_id);
if (lp != NULL)
{
properties = XFSM_PROPERTIES (lp->data);
@@ -774,7 +837,7 @@
{
lp = g_queue_find_custom (manager->pending_properties,
previous_id,
- xfsm_properties_queue_find);
+ (GCompareFunc) xfsm_properties_compare_id);
if (lp != NULL)
{
properties = XFSM_PROPERTIES (lp->data);
@@ -782,20 +845,38 @@
}
}
- if (properties != NULL && properties->startup_timeout_id != 0)
- {
- g_source_remove (properties->startup_timeout_id);
- properties->startup_timeout_id = 0;
- }
-
/* If previous_id is invalid, the SM will send a BadValue error message
* to the client and reverts to register state waiting for another
* RegisterClient message.
*/
if (properties == NULL)
- return FALSE;
+ {
+ xfsm_verbose ("Client Id = %s registering, failed to find matching "
+ "properties\n", previous_id);
+ return FALSE;
+ }
+ /* cancel startup timer */
+ if (properties->startup_timeout_id > 0)
+ {
+ g_source_remove (properties->startup_timeout_id);
+ properties->startup_timeout_id = 0;
+ }
+
+ /* cancel the old child watch, and replace it with one that
+ * doesn't really do anything but reap the child */
+ xfsm_properties_set_default_child_watch (properties);
+
xfsm_client_set_initial_properties (client, properties);
+
+ /* if we've been restarted, we'll want to reset the restart
+ * attempts counter if the client stays alive for a while */
+ if (properties->restart_attempts > 0 &&
properties->restart_attempts_reset_id == 0)
+ {
+ properties->restart_attempts_reset_id = g_timeout_add
(RESTART_RESET_TIMEOUT,
+
xfsm_manager_reset_restart_attempts,
+ properties);
+ }
}
else
{
@@ -1062,6 +1143,7 @@
}
}
+
void
xfsm_manager_save_yourself (XfsmManager *manager,
XfsmClient *client,
@@ -1214,60 +1296,21 @@
}
else
{
- XfsmProperties *properties = xfsm_client_get_properties (client);
+ XfsmProperties *properties = xfsm_client_steal_properties (client);
- if (properties != NULL && xfsm_properties_check (properties))
+ if (properties != NULL)
{
- if (properties->restart_style_hint == SmRestartAnyway)
+ if (xfsm_properties_check (properties))
{
- g_queue_push_tail (manager->restart_properties,
- xfsm_client_steal_properties (client));
+ if (xfsm_manager_handle_failed_properties (manager, properties)
== FALSE)
+ xfsm_properties_free (properties);
}
- else if (properties->restart_style_hint == SmRestartImmediately)
- {
- if (++properties->restart_attempts > MAX_RESTART_ATTEMPTS)
- {
- xfsm_verbose ("Client Id = %s, reached maximum attempts
[Restart attempts = %d]\n"
- " Will be re-scheduled for run on next
startup\n",
- properties->client_id,
properties->restart_attempts);
-
- g_queue_push_tail (manager->restart_properties,
- xfsm_client_steal_properties (client));
- }
-#if 0
- else if (xfsm_manager_run_prop_command (properties,
SmRestartCommand))
- {
- /* XXX - add a timeout here, in case the application does
not come up */
- g_queue_push_tail (manager->pending_properties,
- xfsm_client_steal_properties (client));
- }
-#endif
- }
-
- /* Run the SmDiscardCommand after the client exited in IDLE state.
- * FIXME: Need to handle this better when we support restarting
- * immediately properly.
- * Unfortunately the spec isn't clear about the usage of the discard
- * command. Have to check ksmserver/gnome-session, and come up with
- * consistent behaviour.
- * But for now, this work-around fixes the problem of the evergrowing
- * number of xfwm4 session files when restarting xfwm4 within a
session.
- */
- if (manager->state == XFSM_MANAGER_IDLE &&
properties->discard_command != NULL)
- {
- xfsm_verbose ("Client Id = %s exited while in IDLE state,
running "
- "discard command now.\n\n", properties->client_id);
-
- g_spawn_sync (properties->current_directory,
- properties->discard_command,
- properties->environment,
- G_SPAWN_SEARCH_PATH,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL);
- }
+ else
+ xfsm_properties_free (properties);
}
+ /* regardless of the restart style hint, the current instance of
+ * the client is gone, so remove it from the client list and free it. */
g_queue_remove (manager->running_clients, client);
g_object_unref (client);
}
@@ -1602,6 +1645,13 @@
}
+XfsmManagerState
+xfsm_manager_get_state (XfsmManager *manager)
+{
+ return manager->state;
+}
+
+
GQueue *
xfsm_manager_get_queue (XfsmManager *manager,
XfsmManagerQueueType q_type)
Modified: xfce4-session/trunk/xfce4-session/xfsm-manager.h
===================================================================
--- xfce4-session/trunk/xfce4-session/xfsm-manager.h 2008-10-17 07:59:17 UTC
(rev 28272)
+++ xfce4-session/trunk/xfce4-session/xfsm-manager.h 2008-10-17 08:02:28 UTC
(rev 28273)
@@ -37,9 +37,10 @@
#define XFSM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),
XFSM_TYPE_MANAGER, XfsmManager))
#define XFSM_IS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),
XFSM_TYPE_MANAGER))
-#define DIE_TIMEOUT ( 7 * 1000)
-#define SAVE_TIMEOUT (60 * 1000)
-#define STARTUP_TIMEOUT ( 8 * 1000)
+#define DIE_TIMEOUT ( 7 * 1000)
+#define SAVE_TIMEOUT ( 60 * 1000)
+#define STARTUP_TIMEOUT ( 8 * 1000)
+#define RESTART_RESET_TIMEOUT (5 * 60 * 1000)
typedef enum
{
@@ -80,8 +81,8 @@
void xfsm_manager_signal_startup_done (XfsmManager *manager);
/* call for each client that fails */
-void xfsm_manager_handle_failed_client (XfsmManager *manager,
- XfsmProperties *properties);
+gboolean xfsm_manager_handle_failed_properties (XfsmManager *manager,
+ XfsmProperties *properties);
XfsmClient* xfsm_manager_new_client (XfsmManager *manager,
SmsConn sms_conn,
@@ -144,6 +145,8 @@
XfsmShutdownType xfsm_manager_get_shutdown_type (XfsmManager *manager);
+XfsmManagerState xfsm_manager_get_state (XfsmManager *manager);
+
GQueue *xfsm_manager_get_queue (XfsmManager *manager,
XfsmManagerQueueType q_type);
Modified: xfce4-session/trunk/xfce4-session/xfsm-properties.c
===================================================================
--- xfce4-session/trunk/xfce4-session/xfsm-properties.c 2008-10-17 07:59:17 UTC
(rev 28272)
+++ xfce4-session/trunk/xfce4-session/xfsm-properties.c 2008-10-17 08:02:28 UTC
(rev 28273)
@@ -153,6 +153,7 @@
properties->client_id = g_strdup (client_id);
properties->hostname = g_strdup (hostname);
properties->priority = 50;
+ properties->pid = -1;
return properties;
}
@@ -372,6 +373,14 @@
}
+gint
+xfsm_properties_compare_id (const XfsmProperties *properties,
+ const gchar *client_id)
+{
+ return strcmp (properties->client_id, client_id);
+}
+
+
gboolean
xfsm_properties_check (const XfsmProperties *properties)
{
@@ -385,11 +394,35 @@
void
+xfsm_properties_set_default_child_watch (XfsmProperties *properties)
+{
+ if (properties->child_watch_id > 0)
+ {
+ g_source_remove (properties->child_watch_id);
+ properties->child_watch_id = 0;
+ }
+
+ if (properties->pid != -1)
+ {
+ /* if the PID is still open, we need to close it,
+ * or it will become a zombie when it quits */
+ g_child_watch_add (properties->pid,
+ (GChildWatchFunc) g_spawn_close_pid,
+ NULL);
+ properties->pid = -1;
+ }
+}
+
+void
xfsm_properties_free (XfsmProperties *properties)
{
g_return_if_fail (properties != NULL);
- if (properties->startup_timeout_id != 0)
+ xfsm_properties_set_default_child_watch (properties);
+
+ if (properties->restart_attempts_reset_id > 0)
+ g_source_remove (properties->restart_attempts_reset_id);
+ if (properties->startup_timeout_id > 0)
g_source_remove (properties->startup_timeout_id);
if (properties->client_id != NULL)
g_free (properties->client_id);
Modified: xfce4-session/trunk/xfce4-session/xfsm-properties.h
===================================================================
--- xfce4-session/trunk/xfce4-session/xfsm-properties.h 2008-10-17 07:59:17 UTC
(rev 28272)
+++ xfce4-session/trunk/xfce4-session/xfsm-properties.h 2008-10-17 08:02:28 UTC
(rev 28273)
@@ -36,6 +36,7 @@
struct _XfsmProperties
{
guint restart_attempts;
+ guint restart_attempts_reset_id;
gchar *client_id;
gchar *hostname;
@@ -53,7 +54,10 @@
gchar **shutdown_command;
gchar *user_id;
- guint startup_timeout_id;
+ guint startup_timeout_id;
+
+ GPid pid;
+ guint child_watch_id;
};
@@ -75,6 +79,8 @@
gboolean xfsm_properties_check (const XfsmProperties *properties) G_GNUC_CONST;
+void xfsm_properties_set_default_child_watch (XfsmProperties *properties);
+
gchar **xfsm_strv_from_smprop (const SmProp *prop);
GValue *xfsm_g_value_from_property (XfsmProperties *properties,
@@ -83,4 +89,7 @@
gint xfsm_properties_compare (const XfsmProperties *a,
const XfsmProperties *b) G_GNUC_CONST;
+gint xfsm_properties_compare_id (const XfsmProperties *properties,
+ const gchar *client_id);
+
#endif /* !__XFSM_PROPERTIES_H__ */
Modified: xfce4-session/trunk/xfce4-session/xfsm-startup.c
===================================================================
--- xfce4-session/trunk/xfce4-session/xfsm-startup.c 2008-10-17 07:59:17 UTC
(rev 28272)
+++ xfce4-session/trunk/xfce4-session/xfsm-startup.c 2008-10-17 08:02:28 UTC
(rev 28273)
@@ -63,15 +63,9 @@
{
XfsmManager *manager;
XfsmProperties *properties;
-} XfsmStartupTimeoutData;
+} XfsmStartupData;
-typedef struct
-{
- XfsmManager *manager;
- gchar *client_id;
-} XfsmStartupChildWatchData;
-
/*
Prototypes
*/
@@ -79,15 +73,13 @@
static gboolean xfsm_startup_session_next_prio_group (XfsmManager *manager);
+static void xfsm_startup_data_free (XfsmStartupData *sdata);
static void xfsm_startup_child_watch (GPid pid,
gint status,
gpointer user_data);
-static void xfsm_startup_child_watch_destroy (gpointer user_data);
-
static gboolean xfsm_startup_timeout (gpointer data);
-static void xfsm_startup_timeout_destroy (gpointer data);
-static void xfsm_startup_handle_failed_client (XfsmProperties
*properties,
+static void xfsm_startup_handle_failed_startup (XfsmProperties
*properties,
XfsmManager *manager);
void
@@ -490,13 +482,15 @@
}
-static GPid
-xfsm_startup_session_client (XfsmProperties *properties)
+gboolean
+xfsm_startup_start_properties (XfsmProperties *properties,
+ XfsmManager *manager)
{
- gchar **argv;
- gint argc;
- GPid pid;
- gint n;
+ XfsmStartupData *child_watch_data;
+ XfsmStartupData *startup_timeout_data;
+ gchar **argv;
+ gint argc;
+ gint n;
/* generate the argument vector for the application (expanding variables) */
argc = g_strv_length (properties->restart_command);
@@ -507,13 +501,13 @@
/* fork a new process for the application */
#ifdef HAVE_VFORK
- pid = vfork ();
+ properties->pid = vfork ();
#else
- pid = fork ();
+ properties->pid = fork ();
#endif
/* handle the child process */
- if (pid == 0)
+ if (properties->pid == 0)
{
/* execute the application here */
execvp (argv[0], argv);
@@ -524,14 +518,33 @@
g_strfreev (argv);
/* check if we failed to fork */
- if (G_UNLIKELY (pid < 0))
+ if (G_UNLIKELY (properties->pid < 0))
{
/* tell the user that we failed to fork */
perror ("Failed to fork new process");
- return -1;
+ return FALSE;
}
- return pid;
+ /* set a watch to make sure the child doesn't quit before registering */
+ child_watch_data = g_new (XfsmStartupData, 1);
+ child_watch_data->manager = g_object_ref (manager);
+ child_watch_data->properties = properties;
+ g_child_watch_add_full (G_PRIORITY_LOW, properties->pid,
+ xfsm_startup_child_watch, child_watch_data,
+ (GDestroyNotify) xfsm_startup_data_free);
+
+ /* set a timeout -- client must register in a a certain amount of time
+ * or it's assumed to be broken/have issues. */
+ startup_timeout_data = g_new (XfsmStartupData, 1);
+ startup_timeout_data->manager = g_object_ref (manager);
+ startup_timeout_data->properties = properties;
+ properties->startup_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT,
+ STARTUP_TIMEOUT,
+ xfsm_startup_timeout,
+ startup_timeout_data,
+ (GDestroyNotify)
xfsm_startup_data_free);
+
+ return TRUE;
}
@@ -568,7 +581,6 @@
XfsmProperties *properties;
gint cur_prio_group;
gboolean client_started = FALSE;
- GPid pid;
properties = (XfsmProperties *) g_queue_peek_head (pending_properties);
if (properties == NULL)
@@ -583,6 +595,7 @@
/* quit if we've hit all the clients in the current prio group */
if (properties->priority != cur_prio_group)
{
+ /* we're not starting this one yet; put it back */
g_queue_push_head (pending_properties, properties);
break;
}
@@ -594,35 +607,16 @@
figure_app_name (properties->program));
}
- if (G_LIKELY ((pid = xfsm_startup_session_client (properties)) != -1))
+ if (G_LIKELY (xfsm_startup_start_properties (properties, manager)))
{
- XfsmStartupChildWatchData *cwdata;
- XfsmStartupTimeoutData *stdata;
-
- cwdata = g_new(XfsmStartupChildWatchData, 1);
- cwdata->manager = g_object_ref (manager);
- cwdata->client_id = g_strdup (properties->client_id);
- g_child_watch_add_full (G_PRIORITY_LOW, pid,
- xfsm_startup_child_watch, cwdata,
- xfsm_startup_child_watch_destroy);
-
- stdata = g_new(XfsmStartupTimeoutData, 1);
- stdata->manager = manager;
- stdata->properties = properties;
- properties->startup_timeout_id = g_timeout_add_full
(G_PRIORITY_DEFAULT,
- STARTUP_TIMEOUT,
-
xfsm_startup_timeout,
- stdata,
-
xfsm_startup_timeout_destroy);
-
g_queue_push_tail (starting_properties, properties);
client_started = TRUE;
}
else
{
- /* if starting the app failed, just ditch it */
- xfsm_manager_handle_failed_client (manager, properties);
- xfsm_properties_free (properties);
+ /* if starting the app failed, let the manager handle it */
+ if (xfsm_manager_handle_failed_properties (manager, properties) ==
FALSE)
+ xfsm_properties_free (properties);
}
}
@@ -631,76 +625,77 @@
static void
+xfsm_startup_data_free (XfsmStartupData *sdata)
+{
+ g_object_unref (sdata->manager);
+ g_free (sdata);
+}
+
+
+static void
xfsm_startup_child_watch (GPid pid,
gint status,
gpointer user_data)
{
- XfsmProperties *properties;
- XfsmStartupChildWatchData *cwdata = user_data;
- GQueue *starting_properties;
- GList *lp;
+ XfsmStartupData *cwdata = user_data;
+ GQueue *starting_properties;
- starting_properties = xfsm_manager_get_queue (cwdata->manager,
XFSM_MANAGER_QUEUE_STARTING_PROPS);
+ xfsm_verbose ("Client Id = %s, PID %d exited with status %d\n",
+ cwdata->properties->client_id, (gint)pid, status);
- /* check if we have a starting process with the given client_id */
- for (lp = g_queue_peek_nth_link (starting_properties, 0);
- lp != NULL;
- lp = lp->next)
+ starting_properties = xfsm_manager_get_queue (cwdata->manager,
XFSM_MANAGER_QUEUE_STARTING_PROPS);
+ if (g_queue_find (starting_properties, cwdata->properties) != NULL)
{
- /* check if this properties matches */
- properties = (XfsmProperties *) lp->data;
- if (strcmp (properties->client_id, cwdata->client_id) == 0)
- {
- /* continue startup, this client failed most probably */
- xfsm_startup_handle_failed_client (properties, cwdata->manager);
- break;
- }
+ xfsm_verbose ("Client Id = %s died while starting up\n",
+ cwdata->properties->client_id);
+ xfsm_startup_handle_failed_startup (cwdata->properties, cwdata->manager);
}
-}
+ cwdata->properties->child_watch_id = 0;
+ cwdata->properties->pid = -1;
-static void
-xfsm_startup_child_watch_destroy (gpointer user_data)
-{
- XfsmStartupChildWatchData *cwdata = user_data;
-
- g_object_unref (cwdata->manager);
- g_free (cwdata->client_id);
- g_free (cwdata);
+ g_spawn_close_pid (pid);
}
static gboolean
xfsm_startup_timeout (gpointer data)
{
- XfsmStartupTimeoutData *stdata = data;
+ XfsmStartupData *stdata = data;
+ xfsm_verbose ("Client Id = %s failed to register in time\n",
+ stdata->properties->client_id);
+
stdata->properties->startup_timeout_id = 0;
- xfsm_startup_handle_failed_client(stdata->properties, stdata->manager);
+ xfsm_startup_handle_failed_startup (stdata->properties, stdata->manager);
return FALSE;
}
static void
-xfsm_startup_timeout_destroy (gpointer data)
+xfsm_startup_handle_failed_startup (XfsmProperties *properties,
+ XfsmManager *manager)
{
- g_free (data);
-}
-
-
-static void
-xfsm_startup_handle_failed_client (XfsmProperties *properties,
- XfsmManager *manager)
-{
GQueue *starting_properties = xfsm_manager_get_queue (manager,
XFSM_MANAGER_QUEUE_STARTING_PROPS);
- xfsm_manager_handle_failed_client (manager, properties);
+ /* if our timer hasn't run out yet, kill it */
+ if (properties->startup_timeout_id > 0)
+ {
+ g_source_remove (properties->startup_timeout_id);
+ properties->startup_timeout_id = 0;
+ }
+ xfsm_properties_set_default_child_watch (properties);
+
+ /* not starting anymore, so remove it from the list. tell the manager
+ * it failed, and let it do its thing. */
g_queue_remove (starting_properties, properties);
- xfsm_properties_free (properties);
+ if (xfsm_manager_handle_failed_properties (manager, properties) == FALSE)
+ xfsm_properties_free (properties);
- if (g_queue_peek_head (starting_properties) == NULL)
+ if (g_queue_peek_head (starting_properties) == NULL
+ && xfsm_manager_get_state (manager) == XFSM_MANAGER_STARTUP)
{
/* everything has finished starting or failed; continue startup */
xfsm_startup_session_continue (manager);
Modified: xfce4-session/trunk/xfce4-session/xfsm-startup.h
===================================================================
--- xfce4-session/trunk/xfce4-session/xfsm-startup.h 2008-10-17 07:59:17 UTC
(rev 28272)
+++ xfce4-session/trunk/xfce4-session/xfsm-startup.h 2008-10-17 08:02:28 UTC
(rev 28273)
@@ -30,6 +30,8 @@
void xfsm_startup_foreign (XfsmManager *manager);
void xfsm_startup_begin (XfsmManager *manager);
void xfsm_startup_session_continue (XfsmManager *manager);
+gboolean xfsm_startup_start_properties (XfsmProperties *properties,
+ XfsmManager *manager);
#endif /* !__XFSM_STARTUP_H__ */
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits