[next] telepathy-glib: TpConnection: connect to SelfHandleChanged much earlier
Simon McVittie
smcv at kemper.freedesktop.org
Mon Oct 8 08:23:40 PDT 2012
Module: telepathy-glib
Branch: next
Commit: 70cf7cfcc62418264e3aeb0c346857440a9dfd8f
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=70cf7cfcc62418264e3aeb0c346857440a9dfd8f
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Fri Oct 5 16:06:43 2012 +0100
TpConnection: connect to SelfHandleChanged much earlier
Previously, we only connected to it just before calling GetSelfHandle -
but on the "modern" code path we no longer call that, because
GetAll("...Connection") is just as informative. This meant we missed
self-handle changes on modern connection managers.
This was masked by the fact that the self-handle regression test
deliberately breaks the "modern" code path, because some of its tests
rely on GetSelfHandle being called.
Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55666
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>
---
telepathy-glib/connection.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index 5fd37b1..4a98daf 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -935,6 +935,15 @@ on_self_handle_changed (TpConnection *self,
return;
}
+ if (self->priv->last_known_self_handle == 0)
+ {
+ /* We're going to call GetAll(Connection) anyway, or if the CM
+ * is sufficiently deficient, GetSelfHandle(). */
+ DEBUG ("Ignoring early self-handle change to %u, we'll pick it up later",
+ self_handle);
+ return;
+ }
+
DEBUG ("SelfHandleChanged to %u, I wonder what that means?", self_handle);
self->priv->last_known_self_handle = self_handle;
get_self_contact (self);
@@ -949,11 +958,6 @@ introspect_self_handle (TpConnection *self)
return;
}
- /* this only happens when we introspect after CONNECTED, so there's no need
- * to track whether this is the first time */
- tp_cli_connection_connect_to_self_handle_changed (self,
- on_self_handle_changed, NULL, NULL, NULL, NULL);
-
g_assert (self->priv->introspection_call == NULL);
self->priv->introspection_call = tp_cli_connection_call_get_self_handle (
self, -1, got_self_handle, NULL, NULL, NULL);
@@ -1452,6 +1456,11 @@ tp_connection_constructed (GObject *object)
tp_cli_connection_connect_to_connection_error (self,
tp_connection_connection_error_cb, NULL, NULL, NULL, NULL);
+ /* We need to connect to SelfHandleChanged early, too, so that we're
+ * already connected before we GetAll */
+ tp_cli_connection_connect_to_self_handle_changed (self,
+ on_self_handle_changed, NULL, NULL, NULL, NULL);
+
object_path = tp_proxy_get_object_path (TP_PROXY (self));
g_assert (_tp_connection_parse (object_path, '/',
&(self->priv->proto_name), &(self->priv->cm_name)));
More information about the telepathy-commits
mailing list