Bug 27982

Summary: TpBaseClient: should try to recycle TpConnection and TpAccount object
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: git master   
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/cassidy/telepathy-glib;a=shortlog;h=refs/heads/recycle-27982
Whiteboard:
i915 platform: i915 features:

Description Guillaume Desmottes 2010-05-05 06:27:17 UTC
From bug #27874:

Another thing to consider, which I missed during TpBaseClient code review
(sorry): uniqueness guarantees. At the moment, you always make a new TpAccount
and TpConnection in _tp_base_client_observe_channels, and presumably in the
Approver. I think it should be more like this:

* each TpBaseClient has a reference to a TpAccountManager
* if the TpBaseClient's dbus_daemon is the same as returned by
tp_dbus_daemon_dup(), then the account manager is guaranteed to be the one from
tp_account_manager_dup(); otherwise, it's given by tp_account_manager_new()
* the TpAccount in ObserveChannels is made using
tp_account_manager_ensure_account() on the AM
* the TpConnection is made using tp_account_ensure_connection() on the Account
* the channels are attached to that TpConnection

This means that any TpContacts will all come from the same TpConnection, which
is a considerable win.
Comment 2 Simon McVittie 2010-05-05 07:48:44 UTC
Looks OK, but this:

> +  dbus = tp_dbus_daemon_dup (NULL);
> +  if (self->priv->dbus == dbus)

will attempt to connect to the session/starter bus. Could you add an internal method that this could use instead? Something like:

gboolean
_tp_dbus_daemon_is_the_shared_one (TpDBusDaemon *self)
{
  return (self != NULL && self == starter_bus_daemon);
}
Comment 3 Guillaume Desmottes 2010-05-05 08:06:47 UTC
done.
Comment 4 Simon McVittie 2010-05-05 08:07:46 UTC
Thanks, looks good.
Comment 5 Guillaume Desmottes 2010-05-05 08:11:31 UTC
Merged to master.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.