From bf315eb7328baef9eed1c888ce85e070bcbb1e2a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jul 2010 11:17:21 -0500 Subject: Adding a new variable to adjust the time of the kill switch. --- libindicator/indicator-service.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 55fb650..e9005db 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -55,6 +55,7 @@ struct _IndicatorServicePrivate { DBusGProxy * dbus_proxy; DBusGConnection * bus; guint timeout; + guint timeout_length; GHashTable * watchers; guint this_service_version; }; @@ -164,6 +165,16 @@ indicator_service_init (IndicatorService *self) priv->watchers = NULL; priv->bus = NULL; priv->this_service_version = 0; + priv->timeout_length = 500; + + const gchar * timeoutenv = g_getenv("INDICATOR_SERVICE_SHUTDOWN_TIMEOUT"); + if (timeoutenv != NULL) { + gdouble newtimeout = g_strtod(timeoutenv, NULL); + if (newtimeout >= 1.0f) { + priv->timeout_length = newtimeout; + g_debug("Setting shutdown timeout to: %u", priv->timeout_length); + } + } /* NOTE: We're using g_object_unref here because that's what needs to happen, but you really should call watchers_remove first as well @@ -373,7 +384,9 @@ try_and_get_name_cb (DBusGProxy * proxy, guint status, GError * error, gpointer } IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(service); - priv->timeout = g_timeout_add_seconds(1, timeout_no_watchers, service); + /* Allow some extra time at start up as things can be in high + contention then. */ + priv->timeout = g_timeout_add(priv->timeout_length * 2, timeout_no_watchers, service); return; } @@ -515,7 +528,7 @@ unwatch_core (IndicatorService * service, const gchar * name) priv->timeout = 0; } /* If we don't get a new watcher quickly, we'll shutdown. */ - priv->timeout = g_timeout_add(500, timeout_no_watchers, service); + priv->timeout = g_timeout_add(priv->timeout_length, timeout_no_watchers, service); } return; -- cgit v1.2.3 From 362a2d76391c48ab73538bc5c2106d00ec481c7f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 15 Jul 2010 09:49:53 -0500 Subject: 0.3.10 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 2622d73..7f17df0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.9, ted@canonical.com) +AC_INIT(libindicator, 0.3.10, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.9) +AM_INIT_AUTOMAKE(libindicator, 0.3.10) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3