summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2015-08-19 16:03:48 +0100
committerPhilip Withnall <philip.withnall@collabora.co.uk>2015-08-19 16:03:48 +0100
commit366b5ed1094d070ab9dbcd01965e4f5bfab70694 (patch)
tree700f5af30cecee1446586f4ba44a7c3cf085251a
parent5fce44554b319916041e84a46e89356f6e074762 (diff)
downloadfolks-366b5ed1094d070ab9dbcd01965e4f5bfab70694.tar.gz
telepathy: Improve error handling on connection failure of a CM
If a CM is initially offline when the Tpf.PersonaStore is created, calling this.account.connection.prepare_async() will start trying to connect it. If the host is unreachable, this will result in waiting for a network timeout before Telepathy can declare failure. There are two problems here: • This network timeout may be longer than the quiescence timeout built in to the IndividualAggregator. There’s not much we can do about that. • The GError was not previously handled properly, so the PersonaStore would never reach quiescence anyway. Fix this by falling back to loading the cache if connecting fails.
-rw-r--r--backends/telepathy/lib/tpf-persona-store.vala33
1 files changed, 24 insertions, 9 deletions
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index b8b88540..499f48e4 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -744,7 +744,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this._notify_connection_cb_async.begin ();
}
- private async void _notify_connection_cb_async () throws GLib.Error
+ private async void _notify_connection_cb_async ()
{
debug ("_notify_connection_cb_async() for Tpf.PersonaStore %p ('%s').",
this, this.id);
@@ -753,14 +753,29 @@ public class Tpf.PersonaStore : Folks.PersonaStore
"(ID: %s)", this.id);
/* Ensure the connection is prepared as necessary. */
- yield this.account.connection.prepare_async ({
- TelepathyGLib.Connection.get_feature_quark_contact_list (),
- TelepathyGLib.Connection.get_feature_quark_contact_groups (),
- TelepathyGLib.Connection.get_feature_quark_contact_info (),
- TelepathyGLib.Connection.get_feature_quark_connected (),
- TelepathyGLib.Connection.get_feature_quark_aliasing (),
- 0
- });
+ try
+ {
+ yield this.account.connection.prepare_async ({
+ TelepathyGLib.Connection.get_feature_quark_contact_list (),
+ TelepathyGLib.Connection.get_feature_quark_contact_groups (),
+ TelepathyGLib.Connection.get_feature_quark_contact_info (),
+ TelepathyGLib.Connection.get_feature_quark_connected (),
+ TelepathyGLib.Connection.get_feature_quark_aliasing (),
+ 0
+ });
+ }
+ catch (GLib.Error e)
+ {
+ debug ("Failed to connect CM for Tpf.PersonaStore %p ('%s'): %s",
+ this, this.id, e.message);
+
+ /* If we're disconnected, advertise personas from the cache
+ * instead. */
+ yield this._load_cache (null);
+ this._force_quiescent ();
+
+ return;
+ }
if (!this.account.connection.has_interface_by_id (
iface_quark_connection_interface_contact_list ()))