diff options
author | Ted Gould <ted@gould.cx> | 2010-01-21 09:49:02 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-01-21 09:49:02 -0600 |
commit | c72ff4f03fb1fb7c28c2c8c5dda429dc12f45cd5 (patch) | |
tree | 7f85cf3d1ccbe5252c2fc38456c94b55a2d2b1a3 | |
parent | eaf87facbcfdf77ffe62ea35fd1601ea164e0cde (diff) | |
download | libayatana-indicator-c72ff4f03fb1fb7c28c2c8c5dda429dc12f45cd5.tar.gz libayatana-indicator-c72ff4f03fb1fb7c28c2c8c5dda429dc12f45cd5.tar.bz2 libayatana-indicator-c72ff4f03fb1fb7c28c2c8c5dda429dc12f45cd5.zip |
Setting up the watch_cb function so that in errors it'll try to restart. As most errors will be fixed by trying again.
-rw-r--r-- | libindicator/indicator-service-manager.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c index 891f49e..a06e192 100644 --- a/libindicator/indicator-service-manager.c +++ b/libindicator/indicator-service-manager.c @@ -67,6 +67,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 @@ -319,6 +323,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 +336,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; } |