Re: well-known names note

Simon McVittie <simon.mcvittie-ZGY8ohtN/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Organization Collabora Ltd.
Message-ID <[email protected]>
On 14/04/15 19:40, Havoc Pennington wrote:
> The "correct" way to use dbus - at least
> back in the day, maybe you all have changed it - is to resolve the
> well-known name to a unique name and then use the unique name, thus
> getting a logical "socket" to a specific process.

Just to back this up, here is an opinion from a current D-Bus maintainer:

The correct way is normally, as Havoc said, to resolve the well-known
name to a unique name, and have a stateful conversation with the unique
name from then on.

*If* you happen to know that you are talking to a service specifically
designed to be stateless (or equivalently, one that was designed to
store all state and share it between instances), *then* you can use
by-well-known-name routing, but this is the exception rather than the
rule. For instance, by-well-known-name routing might be OK for like
systemd-hostnamed or systemd-localed, since they have no "state" that is
not stored on disk, and are specifically designed to make an exit +
restart insignificant.

In telepathy-glib's TpProxy mini-D-Bus-binding (it started as a
dbus-glib mitigation layer and grew into most of a binding), one of the
flags that can be set in a subclass is "please use the well-known name"
(it is not the default). If I remember correctly, we only actually have
one object that uses that flag, namely the AccountManager (which is not,
strictly speaking, stateless, but it's a singleton and stores all its
important state, so instances are equivalent to each other across a
crash/restart).

-- 
Simon McVittie
Collabora Ltd. <http://www.collabora.com/>

_______________________________________________
dbus mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.