aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-21 13:04:15 -0600
committerTed Gould <ted@gould.cx>2010-01-21 13:04:15 -0600
commit26454911f8302c11af4030960d3faabedc7c0912 (patch)
treede0ecfa1bf29f3cb1bc2967cc844dc478de0884e
parent923106ed3b629260116a06cc60076182cd93a5b2 (diff)
parentf5232a315c253f98b08aee7bb3ec4e5613340c6b (diff)
downloadlibayatana-indicator-26454911f8302c11af4030960d3faabedc7c0912.tar.gz
libayatana-indicator-26454911f8302c11af4030960d3faabedc7c0912.tar.bz2
libayatana-indicator-26454911f8302c11af4030960d3faabedc7c0912.zip
Upstream release 0.3.1
-rw-r--r--configure.ac4
-rw-r--r--debian/changelog12
-rw-r--r--libindicator/indicator-service-manager.c36
3 files changed, 40 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 04d7d38..1f0ad9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
-AC_INIT(libindicator, 0.3.0, ted@canonical.com)
+AC_INIT(libindicator, 0.3.1, ted@canonical.com)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(libindicator, 0.3.0)
+AM_INIT_AUTOMAKE(libindicator, 0.3.1)
AM_MAINTAINER_MODE
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES])
diff --git a/debian/changelog b/debian/changelog
index 31b0b4c..4c44446 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,16 +1,10 @@
-libindicator (0.3.0-0ubuntu2~ppa2) karmic; urgency=low
+libindicator (0.3.1-0ubuntu1~ppa1) UNRELEASED; urgency=low
- * Upstream Merge
+ * Upstream release 0.3.1
* Adding in entry ordering.
-
- -- Ted Gould <ted@ubuntu.com> Tue, 19 Jan 2010 09:00:50 -0600
-
-libindicator (0.3.0-0ubuntu2~ppa1) karmic; urgency=low
-
- * Upstream Merge
* Adding in the code to restart services
- -- Ted Gould <ted@ubuntu.com> Mon, 18 Jan 2010 12:57:31 -0600
+ -- Ted Gould <ted@ubuntu.com> Thu, 21 Jan 2010 13:03:32 -0600
libindicator (0.3.0-0ubuntu1) lucid; urgency=low
diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c
index 891f49e..7bb9a9b 100644
--- a/libindicator/indicator-service-manager.c
+++ b/libindicator/indicator-service-manager.c
@@ -54,6 +54,7 @@ struct _IndicatorServiceManagerPrivate {
guint this_service_version;
DBusGConnection * bus;
guint restart_count;
+ gint restart_source;
};
/* Signals Stuff */
@@ -67,6 +68,10 @@ static guint signals[LAST_SIGNAL] = { 0 };
/* If this env variable is set, we don't restart */
#define TIMEOUT_ENV_NAME "INDICATOR_SERVICE_RESTART_DISABLE"
#define TIMEOUT_MULTIPLIER 100 /* In ms */
+/* What to reset the restart_count to if we know that we're
+ in a recoverable error condition, but waiting a little bit
+ will probably make things better. 5 ~= 3 sec. */
+#define TIMEOUT_A_LITTLE_WHILE 5
/* Properties */
/* Enum for the properties so that they can be quickly
@@ -164,6 +169,7 @@ indicator_service_manager_init (IndicatorServiceManager *self)
priv->this_service_version = 0;
priv->bus = NULL;
priv->restart_count = 0;
+ priv->restart_source = 0;
/* Start talkin' dbus */
GError * error = NULL;
@@ -197,6 +203,13 @@ indicator_service_manager_dispose (GObject *object)
{
IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(object);
+ /* Removing the idle task to restart if it exists. */
+ if (priv->restart_source != 0) {
+ g_source_remove(priv->restart_source);
+ }
+ /* Block any restart calls */
+ priv->restart_source = -1;
+
/* If we were connected we need to make sure to
tell people that it's no longer the case. */
if (priv->connected) {
@@ -319,6 +332,7 @@ watch_cb (DBusGProxy * proxy, guint service_api_version, guint this_service_vers
if (error != NULL) {
g_warning("Unable to set watch on '%s': '%s'", priv->name, error->message);
g_error_free(error);
+ start_service_again(INDICATOR_SERVICE_MANAGER(user_data));
return;
}
@@ -331,12 +345,20 @@ watch_cb (DBusGProxy * proxy, guint service_api_version, guint this_service_vers
if (service_api_version != INDICATOR_SERVICE_VERSION) {
g_warning("Service is using a different version of the service interface. Expecting %d and got %d.", INDICATOR_SERVICE_VERSION, service_api_version);
dbus_g_proxy_call_no_reply(priv->service_proxy, "UnWatch", G_TYPE_INVALID);
+
+ /* Let's make us wait a little while, then try again */
+ priv->restart_count = TIMEOUT_A_LITTLE_WHILE;
+ start_service_again(INDICATOR_SERVICE_MANAGER(user_data));
return;
}
if (this_service_version != priv->this_service_version) {
g_warning("Service is using a different API version than the manager. Expecting %d and got %d.", priv->this_service_version, this_service_version);
dbus_g_proxy_call_no_reply(priv->service_proxy, "UnWatch", G_TYPE_INVALID);
+
+ /* Let's make us wait a little while, then try again */
+ priv->restart_count = TIMEOUT_A_LITTLE_WHILE;
+ start_service_again(INDICATOR_SERVICE_MANAGER(user_data));
return;
}
@@ -398,6 +420,11 @@ start_service (IndicatorServiceManager * service)
g_return_if_fail(priv->dbus_proxy != NULL);
g_return_if_fail(priv->name != NULL);
+ if (priv->service_proxy != NULL) {
+ g_object_unref(priv->service_proxy);
+ priv->service_proxy = NULL;
+ }
+
/* Check to see if we can get a proxy to it first. */
priv->service_proxy = dbus_g_proxy_new_for_name_owner(priv->bus,
priv->name,
@@ -450,6 +477,7 @@ start_service_again_cb (gpointer data)
IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(data);
priv->restart_count++;
start_service(INDICATOR_SERVICE_MANAGER(data));
+ priv->restart_source = 0;
return FALSE;
}
@@ -462,6 +490,12 @@ start_service_again (IndicatorServiceManager * manager)
{
IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(manager);
+ /* If we've already got a restart source running then
+ let's not do this again. */
+ if (priv->restart_source != 0) {
+ return;
+ }
+
/* Allow the restarting to be disabled */
if (g_getenv(TIMEOUT_ENV_NAME)) {
return;
@@ -474,7 +508,7 @@ start_service_again (IndicatorServiceManager * manager)
/* Not our first time 'round the block. Let's slow this down. */
if (priv->restart_count > 16)
priv->restart_count = 16; /* Not more than 1024x */
- g_timeout_add((1 << priv->restart_count) * TIMEOUT_MULTIPLIER, start_service_again_cb, manager);
+ priv->restart_source = g_timeout_add((1 << priv->restart_count) * TIMEOUT_MULTIPLIER, start_service_again_cb, manager);
}
return;