summaryrefslogtreecommitdiff
path: root/telepathy-glib
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-07-22 17:57:23 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-07-24 13:15:40 +0100
commit60120429b3fd85170cefd72cb913e7014bb98644 (patch)
tree9092db223165c8590d2c163e53e8abce23d3f951 /telepathy-glib
parentada77b717f5bcdf442dff3505db2dacf6c05b8d3 (diff)
downloadtelepathy-glib-60120429b3fd85170cefd72cb913e7014bb98644.tar.gz
TpConnectionManager: retry introspection after CM exits, up to once
Many connection managers automatically exit after 5 seconds of inactivity. If the CM has no .manager file *and* exits in this way while we are introspecting it, we would previously consider it to have failed introspection - but with sufficiently unfortunate timing, that can result in empathy-accounts not considering Haze to exist. To avoid this, without going into an infinite loop if the CM fails to introspect, retry once, but only once. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=67183 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Diffstat (limited to 'telepathy-glib')
-rw-r--r--telepathy-glib/connection-manager.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/telepathy-glib/connection-manager.c b/telepathy-glib/connection-manager.c
index 7130f6298..c816bfcbb 100644
--- a/telepathy-glib/connection-manager.c
+++ b/telepathy-glib/connection-manager.c
@@ -278,6 +278,9 @@ struct _TpConnectionManagerPrivate {
/* TRUE if someone asked us to activate but we're putting it off until
* name_known */
gboolean want_activation;
+ /* TRUE if the CM exited (crashed?) during introspection.
+ * We'll retry, but only once. */
+ gboolean retried_introspection;
};
G_DEFINE_TYPE (TpConnectionManager,
@@ -623,8 +626,7 @@ static void tp_connection_manager_ready_or_failed (TpConnectionManager *self,
const GError *error);
static void
-tp_connection_manager_end_introspection (TpConnectionManager *self,
- const GError *error)
+tp_connection_manager_reset_introspection (TpConnectionManager *self)
{
guint i;
@@ -651,6 +653,14 @@ tp_connection_manager_end_introspection (TpConnectionManager *self,
self->priv->pending_protocols = NULL;
}
+}
+
+static void
+tp_connection_manager_end_introspection (TpConnectionManager *self,
+ const GError *error)
+{
+ tp_connection_manager_reset_introspection (self);
+
DEBUG ("End of introspection, info source %u", self->info_source);
g_signal_emit (self, signals[SIGNAL_GOT_INFO], 0, self->info_source);
tp_connection_manager_ready_or_failed (self, error);
@@ -930,7 +940,20 @@ tp_connection_manager_name_owner_changed_cb (TpDBusDaemon *bus,
/* cancel pending introspection, if any */
if (introspection_in_progress (self))
- tp_connection_manager_end_introspection (self, &e);
+ {
+ if (self->priv->retried_introspection)
+ {
+ DEBUG ("%s, twice: assuming fatal and not retrying", e.message);
+ tp_connection_manager_end_introspection (self, &e);
+ }
+ else
+ {
+ self->priv->retried_introspection = TRUE;
+ DEBUG ("%s: retrying", e.message);
+ tp_connection_manager_reset_introspection (self);
+ tp_connection_manager_continue_introspection (self);
+ }
+ }
/* If our name wasn't known already, a change to "" is just the initial
* state, so we didn't *exit* as such. */